diff --git a/System/Cmd.hs b/System/Cmd.hs index 9ae00589e74370f4803ab52404e8152c148cf15b..5fba064614785ec67afa35404d301813a889bdeb 100644 --- a/System/Cmd.hs +++ b/System/Cmd.hs @@ -22,4 +22,20 @@ module System.Cmd rawSystem, -- :: FilePath -> [String] -> IO ExitCode ) where +#ifndef __NHC__ import System.Process +#else +import System + +rawSystem :: String -> [String] -> IO ExitCode +rawSystem cmd args = system (unwords (map translate (cmd:args))) + +-- copied from System.Process (qv) +translate :: String -> String +translate str = '"' : snd (foldr escape (True,"\"") str) + where escape '"' (b, str) = (True, '\\' : '"' : str) + escape '\\' (True, str) = (True, '\\' : '\\' : str) + escape '\\' (False, str) = (False, '\\' : str) + escape c (b, str) = (False, c : str) + +#endif diff --git a/System/Process.hs b/System/Process.hs index a9ef332dfa96e391a25721eb8adb430b816d4181..fd0dd1932d460f9cac0bdff3f710d835285d256b 100644 --- a/System/Process.hs +++ b/System/Process.hs @@ -7,7 +7,7 @@ -- -- Maintainer : libraries@haskell.org -- Stability : experimental --- Portability : portable +-- Portability : non-portable (requires concurrency) -- -- Operations for creating and interacting with sub-processes. --