DaemonMode.jl icon indicating copy to clipboard operation
DaemonMode.jl copied to clipboard

Enable separate stderr and stdout

Open feanor12 opened this issue 4 years ago • 2 comments

At the moment those two channels are pooled into the output buffer.

When calling an external tool sometimes it is useful to have split output channels.

feanor12 avatar Jan 30 '21 15:01 feanor12

I do not understand well your proposal. Could you give a more detailed suggestion?

dmolina avatar Jan 30 '21 19:01 dmolina

If a script has the following lines

println(stdout,"normal message")
println(stderr,"error message")

Both of the outputs are sent to sock. In a regular script the output could be separated by using julia script.jl &2> /dev/null which pipes stderr into /dev/null.

The redirection can be seen for example here: https://github.com/dmolina/DaemonMode.jl/blob/24930ead0bd536f848c2a3251a0faec284fe1356/src/DaemonMode.jl#L86-L113

I don't need this at the moment and I think the implementation could be tricky, but I guess it could be useful. One way I see would be to encapsulate the two outputs on the sock stream. The other might be to use a second channel.

As a workaround one might use Suppressor.jl inside the script.

feanor12 avatar Jan 30 '21 20:01 feanor12