[Bug libgcj/11801] New: Problems with Process.waitFor() and exitValue()

bryce at mckinlay dot net dot nz gcc-bugzilla@gcc.gnu.org
Tue Aug 5 05:04:00 GMT 2003


PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11801

           Summary: Problems with Process.waitFor() and exitValue()
           Product: gcc
           Version: 3.4
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: libgcj
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: bryce at mckinlay dot net dot nz
                CC: gcc-bugs at gcc dot gnu dot org

There are some bugs with libgcj's POSIX Runtime.exec implementation.

Problem #1: Process.exitValue() only returns the processes exit code if waitFor() has already been 
called, because only waitFor() ever calls waitpid.

Problem #2: Process.waitFor() and Process.exitValue() do not work if they are called from a thread 
other than the thread which called Runtime.exec().  This seems to be because the pid created in 
Runtime.exec() is only considered a child of the thread which created it.

Currently the problem can be hidden in some cases because Process.waitFor() will actually return 0 
if waitpid returns an error other than EINTR.

Possible solution: SIGCHLD handler?



More information about the Gcc-bugs mailing list