sam icon indicating copy to clipboard operation
sam copied to clipboard

Don't remove socket when exiting forked process

Open vtrlx opened this issue 9 months ago • 0 comments

Previously, using any command that forked sam would run the odd risk of causing sam's control socket to exit. This seems to be a consequence of using atexit() to schedule removal of the control socket from the file system.

This commit adds a global boolean named forked, which is set to true in child process after they are forked. The exit handlers removesocket() and rmsocket() are changed such that they don't remove the control sockets if the forked boolean is set to true.

Sam's control socket should only get removed once the main instance exits.

Fixes #75

vtrlx avatar Apr 29 '24 12:04 vtrlx