Run multiple commands from same node.js child process
<p>Is there any way in node.js to fork a new process and run multiple terminal shell commands and execute node.js functions such as fs.writeFileSync from that same process/context. </p>

<p>As an example I want to do the following. Execute all the below in the same process.</p>

<pre><code>exec("git worktree add -b"....);
exec("cd ../");
writeFileSync(...);
</code></pre>

<p>This is an express.js applcation, and because multiple users will be accessing the same filesystem at the same time and performing git actions on the same repo, I want to avoid conflicts by spawning a new process for each one.</p>