Open rarkins opened 4 years ago
Having the same issue, I'm working on a tool that updates the git index, and I want to be able to catch the SIGINT signal to prevent corrupting the index. Because the git process is spawned in the same process group (same console window in windows land), the SIGINT signal is sent to all spawned processes and there's no way to "trap" it in the node.js process.
Being able to pass a spawn option detached: true
(or shell: true
) would solve this issue.
Is this feasible to add, or would it cause problems with the rest of the library?
I have an app that uses this library, and the app has a handler in place to "gracefully" catch SIGINT and exit after the job it's working on is completed. However, it seems that
git
commands fromsimple-git
are being interrupted and returning before work is complete. e.g. aclone
orfetch
.My ideal is for
simple-git
/git
to ignore the SIGINT, but otherwise I need it to fail in Node so that I can detect and exit out. Right now it seems to be interrupted but my app isn't aware.Do you have any ideas for how to handle this? e.g. this answer on SO suggests
shell: true
could help but I'm not sure if that's compatible with how you run/parsegit
commands.