From e97c387e1a56ee54815c3f06277f2295957b822a Mon Sep 17 00:00:00 2001
From: ijones <ijones@syntaxpolice.org>
Date: Tue, 13 Sep 2005 04:00:01 +0000
Subject: [PATCH] patch from krasimir for escaping spaces

BUGFIX: System.Cmd.system was used here but the executable path may
have spaces.  The right way is to use runInteractiveProcess but it isn't
supported from HUGS.  It is easier for a while to quote the path.
---
 Distribution/Simple/Configure.hs | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/Distribution/Simple/Configure.hs b/Distribution/Simple/Configure.hs
index df2c51ca6c..1d1178c06b 100644
--- a/Distribution/Simple/Configure.hs
+++ b/Distribution/Simple/Configure.hs
@@ -227,8 +227,8 @@ getInstalledPackages :: Compiler -> Bool -> Int -> IO [PackageIdentifier]
 getInstalledPackages comp user verbose = do
    when (verbose > 0) $ message "Reading installed packages..."
    withTempFile "." "" $ \tmp -> do
-      let user_flag = if user then " --user" else " --global"
-          cmd_line  = compilerPkgTool comp ++ user_flag ++ " list >" ++ tmp
+      let user_flag = if user then "--user" else "--global"
+          cmd_line  = "\"" ++ compilerPkgTool comp ++ "\" " ++ user_flag ++ " list >" ++ tmp
       when (verbose > 0) $
         putStrLn cmd_line
       res <- system cmd_line
@@ -335,7 +335,7 @@ compilerPkgToolName cmp  = error $ "Unsupported compiler: " ++ (show cmp)
 configCompilerVersion :: CompilerFlavor -> FilePath -> Int -> IO Version
 configCompilerVersion GHC compilerP verbose =
   withTempFile "." "" $ \tmp -> do
-    let cmd_line = compilerP ++ " --version >" ++ tmp
+    let cmd_line = "\"" ++ compilerP ++ "\" --version >" ++ tmp
     when (verbose > 0) $
       putStrLn cmd_line
     maybeExit $ system cmd_line
-- 
GitLab