fix examples to run process /bin/date well : System.Process uses cmd or command.com shell on Windows, doen't use Cygwin or MSYS shell
This commit is contained in:
@ -13,5 +13,10 @@ resource = testio { field = date }
|
||||
-- call a shell command , returning it's output
|
||||
--
|
||||
date :: IO String
|
||||
date = do (_,out,_,_) <- catch (runInteractiveCommand "/bin/date") (\_->error "popen failed")
|
||||
date = do
|
||||
#if !defined(CYGWIN) || !defined(__MINGW32__)
|
||||
(_,out,_,_) <- catch (runInteractiveCommand "/bin/date") (\_->error "popen failed")
|
||||
#else
|
||||
(_,out,_,_) <- catch (runInteractiveCommand "@PREFIX@/../../bin/date") (\_->error "popen failed")
|
||||
#endif
|
||||
hGetLine out
|
@ -10,7 +10,11 @@ resource = unsafe { field = date }
|
||||
-- illustrates the use of the devil's work
|
||||
date :: String
|
||||
date = unsafePerformIO $ do
|
||||
#if !defined(CYGWIN) || !defined(__MINGW32__)
|
||||
(_,outh,_,proc) <- runInteractiveProcess "date" [] Nothing Nothing
|
||||
#else
|
||||
(_,outh,_,proc) <- runInteractiveProcess "@PREFIX@/../../bin/date" [] Nothing Nothing
|
||||
#endif
|
||||
waitForProcess proc
|
||||
s <- hGetContents outh
|
||||
return s
|
Reference in New Issue
Block a user