Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

debug(1) impacts stdout of a command #181

Closed
kape1395 opened this issue Aug 7, 2024 · 1 comment
Closed

debug(1) impacts stdout of a command #181

kape1395 opened this issue Aug 7, 2024 · 1 comment

Comments

@kape1395
Copy link
Contributor

kape1395 commented Aug 7, 2024

While debugging #180 I found that some logging statements appear in the program's stdout instead of being logged (I have omitted the logged statements to make this more readable).

28> exec:debug(0).                                                  
29> exec:run_link("/usr/bin/echo asd", [sync, stdout, stderr, pty]).
{ok,[{stdout,[<<"asd\r\n">>]}]}

30> exec:debug(1).                                                  
31> exec:run_link("/usr/bin/echo asd", [sync, stdout, stderr, pty]).
{ok,[{stdout,[<<"TIOCSWINSZ rows=43430 cols=23527 tty=-1 ret=-1 [exec_impl.cpp:186]\r\r\nTIOCSWINSZ rows=1974839"...>>,
              <<"asd\r\n">>]}]}

Also, if the pty option is specified, stderr is returned as stdout:

49> exec:run_link("/usr/bin/echo asd; (/usr/bin/echo dsa >&2)", [sync, stdout, stderr]).     
{ok,[{stdout,[<<"asd\n">>]},{stderr,[<<"dsa\n">>]}]}
50> exec:run_link("/usr/bin/echo asd; (/usr/bin/echo dsa >&2)", [sync, stdout, stderr, pty]).
{ok,[{stdout,[<<"asd\r\n">>,<<"dsa\r\n">>]}]}

In my case that's minor, as the pty option was specified by a mistake.

@saleyn
Copy link
Owner

saleyn commented Aug 8, 2024

With pty the stderr is returned to stdout. This is not a bug in erlexec but a unfortunately is the limitation of the pty option related to the tty's behavior.

@saleyn saleyn closed this as completed Aug 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants