These seem to do the right thing on a Windows box.

Wed Jun  4 15:31:00 BST 2008  Eric Kow <[EMAIL PROTECTED]>
  * resolve issue770: catch 'does not exist' when running external programs
  Convert these errors into ExitCode 127 (for Windows)

Thu Jun  5 11:55:39 BST 2008  Eric Kow <[EMAIL PROTECTED]>
  * Makefile: prefix -optl only on $(LIBS) that start with '-'
  
  Otherwise, on Windows, if you try to build --with-static-libs, the
  linker will be passed /usr/local/lib/libcurl.a as an argument, which
  makes gcc complain.

New patches:

[resolve issue770: catch 'does not exist' when running external programs
Eric Kow <[EMAIL PROTECTED]>**20080604143100
 Convert these errors into ExitCode 127 (for Windows)
] 
hunk ./src/Exec.lhs 29
 
 import Data.Typeable ( Typeable )
 
+import Control.Exception ( catchJust, Exception(IOException) )
+import Data.List ( isInfixOf )
 #ifndef WIN32
 import Control.Exception ( bracket )
 import System.Posix.Env ( setEnv, getEnv, unsetEnv )
hunk ./src/Exec.lhs 99
   h_stdout <- redirect out WriteMode
   h_stderr <- redirect err WriteMode
 --  putStrLn (unwords (cmd:args ++ map show [inp,out,err]))
-  bracketOnError
+  withExit127 $ bracketOnError
     (do whenDebugMode $ putStrLn $ unwords $ cmd:args ++ ["; #"] ++ map show [inp,out,err]
         runProcess cmd args Nothing Nothing h_stdin h_stdout h_stderr)
     (terminateProcess)
hunk ./src/Exec.lhs 133
        do case oldval of
             Nothing -> unsetEnv var
             Just val -> setEnv var val True)
-    (\_ -> system $ cmd++" \"$"++var++"\"")
+    (\_ -> withExit127 $ system $ cmd++" \"$"++var++"\"")
 
 #else
 
hunk ./src/Exec.lhs 162
 #else
 withoutNonBlock x = do x
 #endif
+
+{-
+Ensure that we exit 127 if the thing we are trying to run does not exist
+(Only needed under Windows)
+-}
+withExit127 :: IO ExitCode -> IO ExitCode
+withExit127 a = catchJust notFoundError a (const $ return $ ExitFailure 127)
+
+notFoundError :: Exception -> Maybe ()
+notFoundError (IOException e) | "runProcess: does not exist" `isInfixOf` show e = Just ()
+notFoundError _ = Nothing
 \end{code}
[Makefile: prefix -optl only on $(LIBS) that start with '-'
Eric Kow <[EMAIL PROTECTED]>**20080605105539
 
 Otherwise, on Windows, if you try to build --with-static-libs, the
 linker will be passed /usr/local/lib/libcurl.a as an argument, which
 makes gcc complain.
] 
hunk ./autoconf.mk.in 26
 LDFLAGS		:= @LDFLAGS@
 OPTLLDFLAGS     := $(addprefix -optl,$(LDFLAGS))
 LIBS            := @LIBS@
-OPTLLIBS        := $(addprefix -optl,$(LIBS))
+OPTLLIBS        := $(filter-out %-,$(LIBS)) $(addprefix -optl,$(filter %-,$(LIBS)))
 GHCFLAGS	:= @GHCFLAGS@ @CPPFLAGS@ @DEFS@
 USE_GNULIBSHA1  := @USE_GNULIBSHA1@
 HAVE_HTTP       := @HAVE_HTTP@

Context:

[TAG 2.0.1rc1
David Roundy <[EMAIL PROTECTED]>**20080603124331] 
Patch bundle hash:
7d218b1ed99d0d3acf5e2472b13188e63c646f2e
_______________________________________________
darcs-users mailing list
[email protected]
http://lists.osuosl.org/mailman/listinfo/darcs-users

Reply via email to