Skip to content
This repository has been archived by the owner on May 10, 2023. It is now read-only.

Run processes detached and kill the process group #292

Merged
merged 1 commit into from
Mar 25, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions lib/process/lein-runner.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ module.exports = (currentWorkingDir, leinPath, args) ->
leinExec = path.join(leinPath, "lein.bat")
envPath = filteredEnv["Path"] || ""
filteredEnv["Path"] = envPath + path.delimiter + leinPath
replProcess = childProcess.spawn leinExec, args, cwd: currentWorkingDir, env: filteredEnv, shell: true
replProcess = childProcess.spawn leinExec, args, cwd: currentWorkingDir, env: filteredEnv, shell: true, detached: true
else
# Mac/Linux
leinExec = "lein"
envPath = filteredEnv["PATH"] || ""
filteredEnv["PATH"] = envPath + path.delimiter + leinPath
replProcess = childProcess.spawn leinExec, args, cwd: currentWorkingDir, env: filteredEnv
replProcess = childProcess.spawn leinExec, args, cwd: currentWorkingDir, env: filteredEnv, detached: true

replProcess.stdout.on 'data', processData
replProcess.stderr.on 'data', processData
Expand All @@ -62,6 +62,6 @@ module.exports = (currentWorkingDir, leinPath, args) ->
when 'input'
replProcess.stdin.write(text)
when 'kill'
replProcess.kill("SIGKILL")
process.kill(-replProcess.pid, 'SIGKILL')
catch error
console.error error