DaanDeMeyer / reproc

A cross-platform (C99/C++11) process library
MIT License
552 stars 65 forks source link

False positive process status being returned by process.poll() - Windows 11 #92

Open ayeganov opened 1 year ago

ayeganov commented 1 year ago

I spawn a single process that I expect to run for a long time. The child process does not spawn other children. It does run without any problems or errors, until the process monitoring it starts reporting that it has exited:

Here is the the function that starts reporting false when the process in fact is still happy and running:

bool ProcessImpl::is_running()
{
  auto [code, ec] = process_.poll(reproc::event::exit, kDefaultPollTimeout);
  if(ec)
  {
    std::cout << "ProcessImpl::is_running() failed: " << ec.message() << std::endl;
  }
  return code == 0 && !ec;
}

Am I forgetting to check something or setting something incorrectly? I have looked through the list of gotchas and don't see anything obvious that would tell me what could be going wrong. Any help would be greatly appreciated.