1 -----------------------------------------------------------------------------
4 -- Copyright : (c) The University of Glasgow 2001
5 -- License : BSD-style (see the file libraries/base/LICENSE)
7 -- Maintainer : libraries@haskell.org
8 -- Stability : provisional
9 -- Portability : portable
11 -- Executing an external command.
13 -----------------------------------------------------------------------------
16 ( system, -- :: String -> IO ExitCode
17 #ifdef __GLASGOW_HASKELL__
18 rawSystem, -- :: FilePath -> [String] -> IO ExitCode
24 #ifdef __GLASGOW_HASKELL__
26 import System.Exit ( ExitCode )
27 import GHC.IOBase ( ioException, IOException(..), IOErrorType(..) )
35 import System (system)
38 -- ---------------------------------------------------------------------------
42 Computation @system cmd@ returns the exit code
43 produced when the operating system processes the command @cmd@.
45 This computation may fail with
47 * @PermissionDenied@: The process has insufficient privileges to
48 perform the operation.
50 * @ResourceExhausted@: Insufficient resources are available to
51 perform the operation.
53 * @UnsupportedOperation@: The implementation does not support
56 On Windows, 'system' is implemented using Windows's native system
57 call, which ignores the @SHELL@ environment variable, and always
58 passes the command to the Windows command interpreter (@CMD.EXE@ or
59 @COMMAND.COM@), hence Unixy shell tricks will not work.
61 #ifdef __GLASGOW_HASKELL__
62 system :: String -> IO ExitCode
63 system "" = ioException (IOError Nothing InvalidArgument "system" "null command" Nothing)
68 rawSystem :: String -> [String] -> IO ExitCode
69 rawSystem cmd args = do
70 p <- runProcess cmd args Nothing Nothing Nothing Nothing Nothing
72 #endif /* __GLASGOW_HASKELL__ */