[commit: process] master: Add a test for better exceptions when ewxecuting programs (06bb985)

Ian Lynagh igloo at earth.li
Sun Jun 2 23:22:36 CEST 2013


Repository : ssh://darcs.haskell.org//srv/darcs/packages/process

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/06bb98518628a91e0d02ba261b00831582942ec5

>---------------------------------------------------------------

commit 06bb98518628a91e0d02ba261b00831582942ec5
Author: Ian Lynagh <ian at well-typed.com>
Date:   Sun Jun 2 20:01:44 2013 +0100

    Add a test for better exceptions when ewxecuting programs

>---------------------------------------------------------------

 tests/all.T             |    1 +
 tests/process010.hs     |   13 +++++++++++++
 tests/process010.stdout |    4 ++++
 3 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/tests/all.T b/tests/all.T
index 32ac4c8..d1984e5 100644
--- a/tests/all.T
+++ b/tests/all.T
@@ -32,3 +32,4 @@ test('T3994', only_ways(['threaded1','threaded2']), compile_and_run, [''])
 test('T4889', normal, compile_and_run, [''])
 
 test('process009', when(opsys('mingw32'), skip), compile_and_run, [''])
+test('process010', normal, compile_and_run, [''])
diff --git a/tests/process010.hs b/tests/process010.hs
new file mode 100644
index 0000000..f5cf17a
--- /dev/null
+++ b/tests/process010.hs
@@ -0,0 +1,13 @@
+
+import System.IO.Error
+import System.Process
+
+main :: IO ()
+main = do run "/bin/true"
+          run "/bin/false"
+          run "/non/existent"
+          putStrLn "Done"
+
+run :: FilePath -> IO ()
+run fp = (rawSystem fp [] >>= print)
+         `catchIOError` \e -> putStrLn ("Exc: " ++ show e)
diff --git a/tests/process010.stdout b/tests/process010.stdout
new file mode 100644
index 0000000..71b3f8e
--- /dev/null
+++ b/tests/process010.stdout
@@ -0,0 +1,4 @@
+ExitSuccess
+ExitFailure 1
+Exc: /non/existent: rawSystem: runInteractiveProcess: exec: does not exist (No such file or directory)
+Done





More information about the ghc-commits mailing list