23 lines
614 B
Plaintext
Raw Normal View History

2005-04-24 08:51:33 +00:00
{-# 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
2005-04-24 08:51:33 +00:00
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