This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author gireeshpunathil
Recipients gireeshpunathil
Date 2017-02-13.15:46:52
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <OFDEA36C51.E21B0C6B-ON002580C6.00569079-652580C6.0056AAD1@notes.na.collabserv.com>
In-reply-to
Content
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 <stdio.h>
#include <unistd.h>
#include <stdlib.h>

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
History
Date User Action Args
2017-02-13 15:46:52gireeshpunathilsetrecipients: + gireeshpunathil
2017-02-13 15:46:52gireeshpunathillinkissue29545 messages
2017-02-13 15:46:52gireeshpunathilcreate