Bug 15088 - closing a pipe connection does not capture pclose return value
closing a pipe connection does not capture pclose return value
Status: CLOSED FIXED
Product: R
Classification: Unclassified
Component: I/O
R 2.15.1 patched
All Linux
: P5 enhancement
Assigned To: R-core
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-10-26 17:18 UTC by egoldlust
Modified: 2013-01-02 18:34 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description egoldlust 2012-10-26 17:18:13 UTC
in src/main/connections.c, the function pipe_close does not capture the return value of its pclose call.

static void pipe_close(Rconnection con)
{
    pclose(((Rfileconn)(con->private))->fp);
    con->isopen = FALSE;
}

Because pclose returns the exit code of the subprocess, there is now no straightforward way to determine whether the subprocess succeeded.

Would it be possible to capture this value and do something along the lines of any of the following:

1) add some sort of field to the connection object that could be read with summary.connection, or
2) have the close.connection() R function return something other than NULL i.e. an object containing status information including this exit code.
3) have a separate function for closing a pipe that specifically returned the result of the pclose call.
4) etc?
Comment 1 Brian Ripley 2013-01-02 18:34:05 UTC
Something like 2 has been done in R-devel.