Update all uses of forkProcess to xfork

This commit is contained in:
Spencer Janssen
2009-12-23 06:45:58 +00:00
parent 98fe292e9f
commit e8c0f39fd5
3 changed files with 8 additions and 16 deletions

View File

@@ -42,15 +42,8 @@ module XMonad.Util.NamedActions (
import XMonad.Actions.Submap(submap) import XMonad.Actions.Submap(submap)
import XMonad(KeySym, KeyMask, X, Layout, Message, import XMonad
XConfig(keys, layoutHook, modMask, terminal, workspaces, XConfig), import System.Posix.Process(executeFile)
io, spawn, whenJust, ChangeLayout(NextLayout), IncMasterN(..),
Resize(..), kill, refresh, screenWorkspace, sendMessage, setLayout,
windows, withFocused, controlMask, mod1Mask, mod2Mask, mod3Mask,
mod4Mask, mod5Mask, shiftMask, xK_1, xK_9, xK_Return, xK_Tab, xK_c,
xK_comma, xK_e, xK_h, xK_j, xK_k, xK_l, xK_m, xK_n, xK_p,
xK_period, xK_q, xK_r, xK_space, xK_t, xK_w, keysymToString)
import System.Posix.Process(executeFile, forkProcess)
import Control.Arrow(Arrow((&&&), second, (***))) import Control.Arrow(Arrow((&&&), second, (***)))
import Data.Bits(Bits((.&.), complement, (.|.))) import Data.Bits(Bits((.&.), complement, (.|.)))
import Data.Function((.), const, ($), flip, id) import Data.Function((.), const, ($), flip, id)
@@ -212,7 +205,7 @@ showKm keybindings = padding $ do
-- | An action to send to 'addDescrKeys' for showing the keybindings. See also 'showKm' and 'showKmSimple' -- | An action to send to 'addDescrKeys' for showing the keybindings. See also 'showKm' and 'showKmSimple'
xMessage :: [((KeyMask, KeySym), NamedAction)] -> NamedAction xMessage :: [((KeyMask, KeySym), NamedAction)] -> NamedAction
xMessage x = addName "Show Keybindings" $ io $ do xMessage x = addName "Show Keybindings" $ io $ do
forkProcess $ executeFile "xmessage" True ["-default", "okay", unlines $ showKm x] Nothing xfork $ executeFile "xmessage" True ["-default", "okay", unlines $ showKm x] Nothing
return () return ()
-- | Merge the supplied keys with 'defaultKeysDescr', also adding a keybinding -- | Merge the supplied keys with 'defaultKeysDescr', also adding a keybinding

View File

@@ -32,7 +32,7 @@ module XMonad.Util.Run (
) where ) where
import System.Posix.IO import System.Posix.IO
import System.Posix.Process (executeFile, forkProcess, createSession) import System.Posix.Process (executeFile, createSession)
import Control.Concurrent (threadDelay) import Control.Concurrent (threadDelay)
import Control.Exception (try) -- use OldException with base 4 import Control.Exception (try) -- use OldException with base 4
import System.IO import System.IO
@@ -67,7 +67,7 @@ runProcessWithInput cmd args input = io $ do
-- | Wait is in µs (microseconds) -- | Wait is in µs (microseconds)
runProcessWithInputAndWait :: MonadIO m => FilePath -> [String] -> String -> Int -> m () runProcessWithInputAndWait :: MonadIO m => FilePath -> [String] -> String -> Int -> m ()
runProcessWithInputAndWait cmd args input timeout = io $ do runProcessWithInputAndWait cmd args input timeout = io $ do
forkProcess $ do xfork $ do
(pin, pout, perr, _) <- runInteractiveProcess cmd args Nothing Nothing (pin, pout, perr, _) <- runInteractiveProcess cmd args Nothing Nothing
hPutStr pin input hPutStr pin input
hFlush pin hFlush pin
@@ -107,7 +107,7 @@ it makes use of shell interpretation by relying on @$HOME@ and
interpolation, whereas the safeSpawn example can be safe because interpolation, whereas the safeSpawn example can be safe because
Firefox doesn't need any arguments if it is just being started. -} Firefox doesn't need any arguments if it is just being started. -}
safeSpawn :: MonadIO m => FilePath -> [String] -> m () safeSpawn :: MonadIO m => FilePath -> [String] -> m ()
safeSpawn prog args = liftIO (try (forkProcess $ executeFile prog True args Nothing) >> return ()) safeSpawn prog args = liftIO (try (xfork $ executeFile prog True args Nothing) >> return ())
-- | Like 'safeSpawn', but only takes a program (and no arguments for it). eg. -- | Like 'safeSpawn', but only takes a program (and no arguments for it). eg.
-- --
@@ -135,7 +135,7 @@ spawnPipe x = io $ do
setFdOption wr CloseOnExec True setFdOption wr CloseOnExec True
h <- fdToHandle wr h <- fdToHandle wr
hSetBuffering h LineBuffering hSetBuffering h LineBuffering
forkProcess $ do xfork $ do
createSession createSession
uninstallSignalHandlers uninstallSignalHandlers
dupTo rd stdInput dupTo rd stdInput

View File

@@ -23,7 +23,6 @@ import XMonad
import Control.Applicative import Control.Applicative
import Control.Concurrent import Control.Concurrent
import Data.Unique import Data.Unique
import System.Posix.Process (forkProcess)
-- $usage -- $usage
-- This module can be used to setup a timer to handle deferred events. -- This module can be used to setup a timer to handle deferred events.
@@ -36,7 +35,7 @@ type TimerId = Int
startTimer :: Rational -> X TimerId startTimer :: Rational -> X TimerId
startTimer s = io $ do startTimer s = io $ do
u <- hashUnique <$> newUnique u <- hashUnique <$> newUnique
forkProcess $ do xfork $ do
d <- openDisplay "" d <- openDisplay ""
rw <- rootWindow d $ defaultScreen d rw <- rootWindow d $ defaultScreen d
threadDelay (fromEnum $ s * 1000000) threadDelay (fromEnum $ s * 1000000)