-
Notifications
You must be signed in to change notification settings - Fork 192
Description
It seems as though there's a built-in assumption that if you set something to run in the background, it will run unsupervised.
I'd like to be able to set up an interactive process (i.e. something that will read from stdin), do something with the process (e.g. log statistics, or set up some tracking of the "job"), and then come back to interact with it. E.g. at the command line I can do:
$ cat &
[1] 571970
$ %1
cat
foo
foo
^Z
[1]+ Stopped cat
But at a REPL using Plumbum:
>>> from plumbum.cmd import cat
>>> from plumbum import BG
>>> _1 = cat & BG
>>> _1
<Future ['/usr/bin/cat'] (running)>
I have a running cat process, but how can I effectively "switch to" it?
I found that I can write to _1.proc._proc.stdin, but it seems like that isn't intended as public API, and it doesn't connect my current input (currently going to Python) to the process.
I thought perhaps this could work the other way around - start by foregrounding the process, and then somehow "suspend" it - but it appears that cat & FG evaluates to None.