When trying to launch the same C++ Linux program, with different arguments and with Poco::process
, I get exit 72 code from my second DummyProcess.
This code snippet below is executed in a thread function, which launches every other time, with different task and duration arguments.
When task-1 is running and task-2 wants to launch, its PID gets assigned (different then task1 pid) and tries to launch. At first, Poco::Process::tryWait()
returns -1 (which means running), but shortly after it returns 72 and program doesn’t actually launch.
command="/DummyProcess"; args{"task","duration"}; Poco::ProcessHandle ph = Poco::Process::launch(command, args)); rc = ph.id();
Everything works fine when executing this snippet in main, not in a thread function, and launching the same program but using two ProcessHandle objects.
Also, everything works fine when processes don’t have to work synchronously. More specifically: if task-1 launches in a thread and it finishes before task-2 launch, then task-2 launches and operates as intended.
Advertisement
Answer
I finally found an answer. I ignorantly didn’t mention that i was running Linux in virtual box on windows host and was using a shared folder..
I noticed that when launching an executable it’s permissions change to -rw-rw-rw from -rwx-rwx-rwx, and i couldn’t change them with chmod. So i noticed something fishy here and moved my DummyProcess executable outside of shared folder and everything works like a charm now.