Apologies for the attachment, I don't have a machine I can 'darcs send' from handy.
1.0.9rc2 seems to be working reasonably well on Windows. For a while I had to use --disable-ssh-cm, but for some reason that problem went during the course of today, I'm not sure why. Does control master work for anyone on Windows?
Cheers, Simon
New patches: [add explicit import list Simon Marlow <[EMAIL PROTECTED]>**20061129160144] { hunk ./AmendRecord.lhs 22 -import System +import System.Exit ( ExitCode(..), exitWith ) } [hFlush after "waiting for lock" message Simon Marlow <[EMAIL PROTECTED]>**20061129160342 On Windows, stdout isn't always in line-buffered mode, but we really want to see the message about waiting for a lock quickly. Mostly because ^C isn't always caught properly on Windows and lock files are often left behind, but that's another storey... ] { hunk ./Lock.lhs 39 - IOMode(WriteMode, AppendMode) ) + IOMode(WriteMode, AppendMode), hFlush, stdout ) hunk ./Lock.lhs 86 + hFlush stdout -- for Windows } [catch exceptions in stdout_is_a_pipe Simon Marlow <[EMAIL PROTECTED]>**20061129160620] { hunk ./Compat.hs 33 +import Control.Exception (catchJust, ioErrors) hunk ./Compat.hs 37 - = do stat <- getFdStatus stdOutput - return (isNamedPipe stat) + = catchJust ioErrors + (do stat <- getFdStatus stdOutput + return (isNamedPipe stat)) + (\_ -> return False) } [Use System.Process on Windows Simon Marlow <[EMAIL PROTECTED]>**20061129160710 This was an attempt to address "[issue218] Patch bundle failed hash", but unfortunately it doesn't fix the problem. Still, System.Process is a better way to invoke external commands these days. For now, the new code only replaces the Windows version of exec. This means that GHC 6.4 will be required to build darcs on Windows. Better would be to add a configure test, but I ran out of time here. ] { hunk ./Exec.lhs 25 -import System -import System.Cmd (rawSystem) -import IO +import System.Exit ( ExitCode ) +import System.Cmd ( rawSystem ) +import Control.Monad ( liftM ) + +#ifdef WIN32 hunk ./Exec.lhs 31 -#ifndef WIN32 +import System.Process +import System.IO ( IOMode(..), openBinaryFile, stdout ) +import Control.Exception ( bracketOnError ) +import GHC.Handle ( hDuplicate ) + -- urgh. hDuplicate isn't available from a standard place. hunk ./Exec.lhs 37 +#else + +import System hunk ./Exec.lhs 43 -import Monad ( liftM ) hunk ./Exec.lhs 73 + deriving Show hunk ./Exec.lhs 80 - On Windows we call the system function with a command line - string. The string has the arguments in quotes, and contains - redirection operators. + On Windows we use System.Process, which does the necessary quoting + and redirection for us behind the scenes. In the future, we can do + it this way on Unix too (we currently require to compile with GHC + 6.2 on Unix, and 6.2 didn't have System.Process). hunk ./Exec.lhs 86 -exec cmd args (inp,out,err) = - system $ cmd ++ " " ++ in_quotes_unwords args - ++ (redirect "<" inp) - ++ (redirect ">" out) - ++ (redirect "2>" err) -- order is important if err is Stdout - where redirect op value = - case value of - -- FIXME: are all these spaces necessary? - AsIs -> "" - Null -> " " ++ op ++ " " ++ "NUL" - File "/dev/null" -> -- safety catch - " " ++ op ++ " " ++ "NUL" - File fp -> " " ++ op ++ " \"" ++ fp ++ "\"" -- fp in quotes - Stdout -> " " ++ op ++ "&1" - -in_quotes_unwords :: [String] -> [Char] -in_quotes_unwords (a:as) = "\""++a++"\" "++ in_quotes_unwords as -in_quotes_unwords [] = "" +exec cmd args (inp,out,err) = do + h_stdin <- redirect inp ReadMode + h_stdout <- redirect out WriteMode + h_stderr <- redirect err WriteMode +-- putStrLn (unwords (cmd:args ++ map show [inp,out,err])) + bracketOnError + (runProcess cmd args Nothing Nothing h_stdin h_stdout h_stderr) + (terminateProcess) + (waitForProcess) + where + redirect AsIs _ = return Nothing + redirect Null mode = Just `liftM` openBinaryFile "NUL" mode + redirect (File "/dev/null") mode = redirect Null mode + redirect (File f) mode = Just `liftM` openBinaryFile f mode + redirect Stdout _ = Just `liftM` hDuplicate stdout + -- hDuplicate stdout rather than passing stdout itself, + -- because runProcess closes the Handles we pass it. } Context: [TAG 1.0.9rc2 Tommy Pettersson <[EMAIL PROTECTED]>**20061116140351] Patch bundle hash: 064dfc2f9bc94d803ffbcb96d567e5c914d4d2b7
_______________________________________________ darcs-devel mailing list darcs-devel@darcs.net http://www.abridgegame.org/cgi-bin/mailman/listinfo/darcs-devel