[issue35060] subprocess output seems to depend on size of terminal screen

2018-10-24 Thread Stéphane Wirtel
Stéphane Wirtel added the comment: Here is the doc from ps with man. > man ps If ps cannot determine display width, as when output is redirected (piped) into a file or another command, the output width is undefined (it may be 80, unlimited, determined by the TERM variable, and so on). The

[issue35060] subprocess output seems to depend on size of terminal screen

2018-10-24 Thread Stéphane Wirtel
Change by Stéphane Wirtel : -- status: open -> closed ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue35060] subprocess output seems to depend on size of terminal screen

2018-10-24 Thread Edward Pratt
Edward Pratt added the comment: You are correct. It works as expected outside of the REPL. > On Oct 24, 2018, at 4:34 PM, Stéphane Wirtel wrote: > > > Stéphane Wirtel added the comment: > > My script: > > #!/usr/bin/env python > import pathlib > import subprocess > > output =

[issue35060] subprocess output seems to depend on size of terminal screen

2018-10-24 Thread Stéphane Wirtel
Stéphane Wirtel added the comment: My script: #!/usr/bin/env python import pathlib import subprocess output = subprocess.check_output(['ps', 'aux']) pathlib.Path('/tmp/ps_aux.txt').write_bytes(output) When I execute the following script in the REPL, I get your issue but for me, it's normal

[issue35060] subprocess output seems to depend on size of terminal screen

2018-10-24 Thread Stéphane Wirtel
Stéphane Wirtel added the comment: just one question, did you use this command in the REPL? -- ___ Python tracker ___ ___

[issue35060] subprocess output seems to depend on size of terminal screen

2018-10-24 Thread Edward Pratt
Edward Pratt added the comment: I don’t think that is true. I tried grepping for what I need in a very small terminal and still got the correct result. > On Oct 24, 2018, at 1:40 PM, Eryk Sun wrote: > > > Eryk Sun added the comment: > > This is due to the ps command itself. You'd have

[issue35060] subprocess output seems to depend on size of terminal screen

2018-10-24 Thread Eryk Sun
Eryk Sun added the comment: This is due to the ps command itself. You'd have the same problem when piping to grep or redirecting output to a file. I don't know how it determines terminal size. I tried overriding stdin, stdout and stderr to pipes and calling setsid() in the forked child

[issue35060] subprocess output seems to depend on size of terminal screen

2018-10-24 Thread Stéphane Wirtel
Stéphane Wirtel added the comment: Very strange, I tried with 3.8a and I did not get this issue. Normally we use a pipe for stdin and stdout when we use check_output, so in this case, there is no relation with the size of the terminal. this is just a stream. second point, you explain that

[issue35060] subprocess output seems to depend on size of terminal screen

2018-10-24 Thread Edward Pratt
New submission from Edward Pratt : I am looking for a string inside of a process, and it seems that the output of the check_output command depends on the screen size of the terminal I run the code in. Here I ran the code with a normal screen resolution: >>> result =