FIX signal handlers for forked processes

This commit is contained in:
Nathan Dwarshuis 2022-12-29 12:05:08 -05:00
parent 0a848c4aa7
commit 6689a53585
1 changed files with 6 additions and 6 deletions

View File

@ -42,12 +42,12 @@ withDefaultSignalHandlers =
addGroupSession :: P.ProcessConfig x y z -> P.ProcessConfig x y z
addGroupSession = P.setCreateGroup True . P.setNewSession True
-- readProcess :: P.ProcessConfig a b c -> IO (ExitCode, B.ByteString, B.ByteString)
-- readProcess = withDefaultSignalHandlers . P.readProcess
runProcess :: P.ProcessConfig a b c -> IO ExitCode
runProcess = withDefaultSignalHandlers . P.runProcess
startProcess :: P.ProcessConfig a b c -> IO (P.Process a b c)
startProcess = withDefaultSignalHandlers . P.startProcess
shell :: T.Text -> P.ProcessConfig () () ()
shell = addGroupSession . P.shell . T.unpack
@ -55,14 +55,14 @@ proc :: FilePath -> [T.Text] -> P.ProcessConfig () () ()
proc cmd args = addGroupSession $ P.proc cmd (T.unpack <$> args)
spawn :: MonadIO m => T.Text -> m ()
spawn = liftIO . void . P.startProcess . shell
spawn = liftIO . void . startProcess . shell
spawnAt :: MonadIO m => FilePath -> T.Text -> m ()
spawnAt fp = liftIO . void . P.startProcess . P.setWorkingDir fp . shell
spawnAt fp = liftIO . void . startProcess . P.setWorkingDir fp . shell
spawnStdin :: MonadIO m => B.ByteString -> T.Text -> m ()
spawnStdin i =
liftIO . void . P.startProcess . P.setStdin (P.byteStringInput i) . shell
liftIO . void . startProcess . P.setStdin (P.byteStringInput i) . shell
spawnCmd :: MonadIO m => FilePath -> [T.Text] -> m ()
spawnCmd cmd = spawn . fmtCmd cmd