Bad File Descriptor error when running boost::process::system

523 views Asked by At

When running following code, I get an error in XCode output saying

nw_path_close_fd Failed to close guarded necp fd 47 [9: Bad file descriptor]

Code:

#include <boost/process.hpp>
int main()
{       
   boost::process::ipstream outStream;
   boost::process::system( "df", boost::process::std_out > outStream );
}

Boost version 1.70

XCode version 11.3.1

Error is also present even if I just run boost::process::system( "df" )

Saw this post: boost::process system leaking file descriptors , I tried making the change suggested in posix/executor.hpp. But I still get the error. (After making the change I did not do any boost library build. I thought, it might not be required as it is just an hpp file change)

Update:

I was able to get the information that I needed(mapping between a network uri and mounted volume) without using df utility(Thanks to Timemage). But keeping this question open as it was un-related to this use-case.

0

There are 0 answers