make safeCommand stop the process if the thread gets killed
And a comment on a todo item that this commit is perhaps the start of solving.
This commit is contained in:
parent
156e728b56
commit
e1fc4f7594
2 changed files with 36 additions and 3 deletions
|
@ -81,9 +81,9 @@ safeSystem :: FilePath -> [CommandParam] -> IO ExitCode
|
|||
safeSystem command params = safeSystem' command params id
|
||||
|
||||
safeSystem' :: FilePath -> [CommandParam] -> (CreateProcess -> CreateProcess) -> IO ExitCode
|
||||
safeSystem' command params mkprocess = do
|
||||
(_, _, _, pid) <- createProcess p
|
||||
waitForProcess pid
|
||||
safeSystem' command params mkprocess =
|
||||
withCreateProcess p $ \_ _ _ pid ->
|
||||
waitForProcess pid
|
||||
where
|
||||
p = mkprocess $ proc command (toCommand params)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue