l4mer <janusz.dzied...@gmail.com> added the comment: I) Manual test for subprocess32:
janusz@nc6120:~$ python Python 2.7.12 (default, Nov 19 2016, 06:48:10) [GCC 5.4.0 20160609] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import subprocess32 >>> cmd = ["ssh", "root@localhost", "-p", "50494", "whoami"] >>> buf = subprocess32.check_output(cmd, stderr=subprocess32.STDOUT) >>> print buf root >>> janusz@nc6120:~$ ssh root@localhost -p 50494 -O exit Exit request sent. janusz@nc6120:~$ python Python 2.7.12 (default, Nov 19 2016, 06:48:10) [GCC 5.4.0 20160609] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import subprocess32 >>> cmd = ["ssh", "root@localhost", "-p", "50494", "whoami"] >>> buf = subprocess32.check_output(cmd, stderr=subprocess32.STDOUT) after 20 seconds ^CTraceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/lib/python2.7/dist-packages/subprocess32.py", line 628, in check_output output, unused_err = process.communicate(timeout=timeout) File "/usr/lib/python2.7/dist-packages/subprocess32.py", line 915, in communicate stdout = _eintr_retry_call(self.stdout.read) File "/usr/lib/python2.7/dist-packages/subprocess32.py", line 543, in _eintr_retry_call return func(*args) KeyboardInterrupt >>> II) When omit stderr: janusz@nc6120:~$ ssh root@localhost -p 50494 -O exit Exit request sent. janusz@nc6120:~$ python Python 2.7.12 (default, Nov 19 2016, 06:48:10) [GCC 5.4.0 20160609] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import subprocess32 >>> cmd = ["ssh", "root@localhost", "-p", "50494", "whoami"] >>> buf = subprocess32.check_output(cmd) >>> print buf root >>> Strace for stderr=None: mmap2(NULL, 262144, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7071000 close(6) = 0 close(5) = 0 close(4) = 0 ugetrlimit(RLIMIT_NOFILE, {rlim_cur=1024, rlim_max=64*1024}) = 0 close(3) = 0 pipe2([3, 4], O_CLOEXEC) = 0 fstat64(3, {st_mode=S_IFIFO|0600, st_size=0, ...}) = 0 fcntl64(3, F_GETFL) = 0 (flags O_RDONLY) pipe2([5, 6], O_CLOEXEC) = 0 clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0xb74e3768) = 2728 close(6) = 0 close(4) = 0 brk(0x93d2000) = 0x93d2000 read(5, "", 50000) = 0 brk(0x93c6000) = 0x93c6000 close(5) = 0 fstat64(3, {st_mode=S_IFIFO|0600, st_size=0, ...}) = 0 _llseek(3, 0, 0xbfe23f90, SEEK_CUR) = -1 ESPIPE (Illegal seek) read(3, "root\n", 6) = 5 read(3, "", 1) = 0 --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=2728, si_uid=1000, si_status=0, si_utime=6, si_stime=0} --- close(3) = 0 waitpid(2728, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], 0) = 2728 rt_sigaction(SIGINT, {SIG_DFL, [], 0}, {0x8183c10, [], 0}, 8) = 0 brk(0x93c4000) = 0x93c4000 exit_group(0) = ? +++ exited with 0 +++ ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue31712> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com