[issue29545] Python behavioral difference between Linux and AIX

2017-03-17 Thread Michael Felt

Michael Felt added the comment:

Curious.

First pass: using python2.7.12 also hanged as program, on the close()

second pass: interactive - do the read first, then the close - seems to work:

root@x064:[/data/prj/python/issues/29545]cat hello.py
#!/usr/bin/env python
import errno
import os
import pty
from subprocess import Popen, STDOUT

master_fd, slave_fd = pty.openpty()
proc = Popen(['./hello'],stdout=slave_fd, close_fds=True)
os.close(slave_fd)
data = os.read(master_fd, 512)
print('got ' + repr(data))
root@x064:[/data/prj/python/issues/29545]python
Python 2.7.12 (default, Sep 29 2016, 12:02:17) [C] on aix5
Type "help", "copyright", "credits" or "license" for more information.
>>> import errno
import os
import pty
from subprocess import Popen, STDOUT
>>> >>> >>> >>>
>>> master_fd, slave_fd = pty.openpty()
>>> master_fd
3
>>> slave_fd
4
>>> proc = Popen(['./hello'],stdout=slave_fd, close_fds=True)
>>> data = os.read(master_fd, 512)
>>> datat
'hello world\r\n'
>>> os.close(slave_fd)
>>> print (got '
  File "", line 1
print (got '
   ^
SyntaxError: EOL while scanning string literal
>>> print('got ' + repr(data))
got 'hello world\r\n'
>>> quit()

pass 3:
swap the close() and the read() and the program works fine.

"hello.py" 11 lines, 265 characters

root@x064:[/data/prj/python/issues/29545]cat hello.py
#!/usr/bin/env python
import errno
import os
import pty
from subprocess import Popen, STDOUT

master_fd, slave_fd = pty.openpty()
proc = Popen(['./hello'],stdout=slave_fd, close_fds=True)
data = os.read(master_fd, 512)
os.close(slave_fd)
print('got ' + repr(data))

root@x064:[/data/prj/python/issues/29545]./hello.py
got 'hello world\r\n'
root@x064:[/data/prj/python/issues/29545]

--
nosy: +aixto...@gmail.com

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29545] Python behavioral difference between Linux and AIX

2017-03-06 Thread Anna Henningsen

Changes by Anna Henningsen :


--
nosy: +addaleax

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29545] Python behavioral difference between Linux and AIX

2017-02-13 Thread Eric N. Vander Weele

Changes by Eric N. Vander Weele :


--
nosy: +ericvw

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29545] Python behavioral difference between Linux and AIX

2017-02-13 Thread Gireesh

New submission from Gireesh:

Here is my python code (parent):

#!/usr/bin/env python
import errno
import os
import pty
from subprocess import Popen, STDOUT

master_fd, slave_fd = pty.openpty()
proc = Popen(['./a.out'],stdout=slave_fd, close_fds=True)
os.close(slave_fd)
data = os.read(master_fd, 512)
print('got ' + repr(data))

Child(C++):
#include 
#include 
#include 

int main()
{
printf("hello world\n");
exit(0);
}

behavior: 
Linux:
got 'hello world\r\r\n'
AIX: Hangs.

versions:
Linux:
Linux 2.6.32-131.12.1.el6.x86_64 #1 SMP Sun Jul 31 16:44:56 EDT 2011 
x86_64 x86_64 x86_64 GNU/Linux
AIX: 1 6 00F460A94C00
Python: 2.7.10

--
messages: 287706
nosy: gireeshpunathil
priority: normal
severity: normal
status: open
title: Python behavioral difference between Linux and AIX

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com