don't close all unused descriptors in the child, this seems unnecessary and breaks some (admittedly buggy) children (e.g. xboard)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@57324 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -542,30 +542,10 @@ long wxExecute(char **argv, int flags, wxProcess *process)
|
|||||||
}
|
}
|
||||||
else if ( pid == 0 ) // we're in child
|
else if ( pid == 0 ) // we're in child
|
||||||
{
|
{
|
||||||
// These lines close the open file descriptors to to avoid any
|
// NB: we used to close all the unused descriptors of the child here
|
||||||
// input/output which might block the process or irritate the user. If
|
// but this broke some programs which relied on e.g. FD 1 being
|
||||||
// one wants proper IO for the subprocess, the right thing to do is to
|
// always opened so don't do it any more, after all there doesn't
|
||||||
// start an xterm executing it.
|
// seem to be any real problem with keeping them opened
|
||||||
if ( !(flags & wxEXEC_SYNC) )
|
|
||||||
{
|
|
||||||
// FD_SETSIZE is unsigned under BSD, signed under other platforms
|
|
||||||
// so we need a cast to avoid warnings on all platforms
|
|
||||||
for ( int fd = 0; fd < (int)FD_SETSIZE; fd++ )
|
|
||||||
{
|
|
||||||
if ( fd == pipeIn[wxPipe::Read]
|
|
||||||
|| fd == pipeOut[wxPipe::Write]
|
|
||||||
|| fd == pipeErr[wxPipe::Write]
|
|
||||||
|| fd == (execData.pipeEndProcDetect)[wxPipe::Write] )
|
|
||||||
{
|
|
||||||
// don't close this one, we still need it
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// leave stderr opened too, it won't do any harm
|
|
||||||
if ( fd != STDERR_FILENO )
|
|
||||||
close(fd);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#if !defined(__VMS) && !defined(__EMX__)
|
#if !defined(__VMS) && !defined(__EMX__)
|
||||||
if ( flags & wxEXEC_MAKE_GROUP_LEADER )
|
if ( flags & wxEXEC_MAKE_GROUP_LEADER )
|
||||||
|
Reference in New Issue
Block a user