Generalize safe/unsafeSpawn to MonadIO

This commit is contained in:
Spencer Janssen
2007-11-09 07:38:10 +00:00
parent 0e016a6fa5
commit 283001699d

View File

@@ -104,9 +104,9 @@ seconds = fromEnum . (* 1000000)
$HOME and interpolation, whereas the safeSpawn example can be safe because Firefox doesn't need any arguments if it is $HOME and interpolation, whereas the safeSpawn example can be safe because Firefox doesn't need any arguments if it is
just being started. just being started.
-} -}
safeSpawn :: FilePath -> String -> X () safeSpawn :: MonadIO m => FilePath -> String -> m ()
safeSpawn prog arg = io (try (forkProcess $ executeFile prog True [arg] Nothing) >> return ()) safeSpawn prog arg = liftIO (try (forkProcess $ executeFile prog True [arg] Nothing) >> return ())
unsafeSpawn :: String -> X () unsafeSpawn :: MonadIO m => String -> m ()
unsafeSpawn = spawn unsafeSpawn = spawn
-- | Run a given program in the preferred terminal emulator. This uses safeSpawn. -- | Run a given program in the preferred terminal emulator. This uses safeSpawn.