0

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.

sajas
  • 1,599
  • 1
  • 17
  • 39
  • What is `nw_path_close_fd`? Is it part of your own code or...? Please provide a [mcve]. – G.M. May 14 '20 at 08:44
  • nw_path_close_fd is not part of my code. What I understand is that, the system method is supposed to run mac df utility as a process and transfer the output of the process to the stream provided. – sajas May 14 '20 at 10:12
  • The initial code that I took as reference was using popen to run and acquire the out put and later using the FILE * returned to go through the data. I wanted to try something that could direct the output to a data stream and use it to collect data. – sajas May 14 '20 at 10:15

0 Answers0