Update examples
This commit is contained in:
22
testsuite/makewith/io/TestIO.conf.in
Normal file
22
testsuite/makewith/io/TestIO.conf.in
Normal file
@ -0,0 +1,22 @@
|
||||
{-# OPTIONS -cpp #-}
|
||||
--
|
||||
-- Copyright (c) 2004 Don Stewart - http://www.cse.unsw.edu.au/~dons
|
||||
-- LGPL version 2.1 or later (see http://www.gnu.org/copyleft/lesser.html)
|
||||
--
|
||||
|
||||
import System.IO
|
||||
import System.Process
|
||||
|
||||
resource = testio { field = date }
|
||||
|
||||
--
|
||||
-- call a shell command , returning it's output
|
||||
--
|
||||
date :: IO String
|
||||
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
|
Reference in New Issue
Block a user