I've pushed a couple of process to background and redirected the output to /dev/null. I want undo that and see what's happening since its been in the background for a long time.
Is there a way to undo the > /dev/null redirection and bring the process to foreground?
I think you question would be better posted on unix.
There, you can find How to change the output redirection of a running process?, which exactly your question casted in a more general form.
From the answers, and from the 3rd party tool (redirect) suggested in the accepted answer by its creator, which is mostly written in C, I deduce that there's no shell-only way to accomplish what you want.
However that question is from 2012, so you might want to ask a new one to see if something changed in the meanwhile.
Last but not least, doing some search in man bash I've found the Coprocesses section, that reads
[…] A coprocess is executed asynchronously in a subshell, as if the command had been terminated with the & control operator, with a two-way pipe established between the executing shell and the coprocess. […] The standard output of command is connected via a pipe to a file descriptor in the executing shell, and that file descriptor is assigned to NAME[0]. The standard input […]
which is probably a way to launch processes in background without losing the ability to change their file descriptors, if I interpret the quote correctly.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With