2005-09-03 04:45:14 +00:00

23 lines
614 B
Plaintext

{-# 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