saleyn / erlexec

Execute and control OS processes from Erlang/OTP
https://hexdocs.pm/erlexec/readme.html
Other
541 stars 141 forks source link

Stdout to stderr redirect option is not working #18

Closed saleyn closed 11 years ago

saleyn commented 11 years ago

When using {stdout, stderr} redirection option, output is printed to screen instead of being delivered to the calling process:

6> f(I), {ok, _, I} = exec:run("echo TEST", [stderr, {stdout, stderr}]).         
{ok,<0.1396.0>,11509}
7> TEST

7> flush().
ok

Workaround: add 1>&2 redirect on command line:

9> f(I), {ok, _, I} = exec:run("echo TEST 1>&2", [stderr]).
{ok,<0.1399.0>,11510}
10> flush().                                                                  
Shell got {stderr,11510,<<"TEST\n">>}
ok

This issue doesn't affect the {stderr, stdout} redirection, which works correctly.

saleyn commented 11 years ago

Fixed in last commit