ccl icon indicating copy to clipboard operation
ccl copied to clipboard

WIP Add :directory parameter to ccl:run-program

Open jdz opened this issue 5 years ago • 6 comments

jdz avatar Aug 13 '20 08:08 jdz

Will this function work with multiple threads without race conditions? We are accessing CWD, which is a process-global singular resource, so multiple threads which launch programs simultaneously may collide with each other on attempting to set this.

phoe avatar Aug 13 '20 08:08 phoe

Will this function work with multiple threads without race conditions?

The directory is changed in the child process after fork (right before executing the external program), and I'm pretty sure the issues you mention are not relevant. Am I missing something?

jdz avatar Aug 13 '20 09:08 jdz

OK - if we have already forked, then we are mutating the new process's CWD, and so the old process's CWD is untouched. Thanks for clarification.

phoe avatar Aug 13 '20 09:08 phoe

One thing I'm wondering is whether the external command should be executed if chdir fails? I think not, so more work needs to be done here.

jdz avatar Aug 13 '20 09:08 jdz

Imagine the command is “rm”. Directory context is very important.

On Aug 13, 2020, at 05:11, Jānis Džeriņš [email protected] wrote:

 One thing I'm wondering is whether the external command should be executed if chdir fails? I think not, so more work needs to be done here.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.

xach avatar Aug 13 '20 09:08 xach

My (not very original) plan is to create a pipe and communicate any failures to parent process through that.

jdz avatar Aug 13 '20 09:08 jdz