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:
parent
685ba637b6
commit
491477aeac
2
Makefile
2
Makefile
@ -79,6 +79,8 @@ clean:
|
||||
find examples -name '*.o' -exec rm {} \;
|
||||
find examples -name '*.core' -exec rm {} \;
|
||||
find examples -name 'package.conf' -exec rm {} \;
|
||||
rm -f examples/makewith/io/TestIO.conf
|
||||
rm -f examples/makewith/unsafeio/Unsafe.conf
|
||||
rm -rf examples/hmake/lib-plugs/plugs
|
||||
rm -rf examples/hmake/one-shot/runplugs
|
||||
rm -f EvalHaskell.h
|
||||
|
5
configure
vendored
5
configure
vendored
@ -3036,7 +3036,8 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
|
||||
test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
|
||||
|
||||
|
||||
ac_config_files="$ac_config_files config.mk config.h"
|
||||
# System.Process uses cmd or command.com shell on Windows, doen't use Cygwin or MSYS shell
|
||||
ac_config_files="$ac_config_files config.mk config.h examples/makewith/io/TestIO.conf examples/makewith/unsafeio/Unsafe.conf"
|
||||
|
||||
|
||||
cat >confcache <<\_ACEOF
|
||||
@ -3592,6 +3593,8 @@ do
|
||||
# Handling of arguments.
|
||||
"config.mk" ) CONFIG_FILES="$CONFIG_FILES config.mk" ;;
|
||||
"config.h" ) CONFIG_FILES="$CONFIG_FILES config.h" ;;
|
||||
"examples/makewith/io/TestIO.conf" ) CONFIG_FILES="$CONFIG_FILES examples/makewith/io/TestIO.conf" ;;
|
||||
"examples/makewith/unsafeio/Unsafe.conf" ) CONFIG_FILES="$CONFIG_FILES examples/makewith/unsafeio/Unsafe.conf" ;;
|
||||
*) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
|
||||
echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
|
||||
{ (exit 1); exit 1; }; };;
|
||||
|
@ -218,7 +218,8 @@ AC_SUBST(SYMS)
|
||||
|
||||
AC_PROG_INSTALL
|
||||
|
||||
AC_CONFIG_FILES(config.mk config.h)
|
||||
# System.Process uses cmd or command.com shell on Windows, doen't use Cygwin or MSYS shell
|
||||
AC_CONFIG_FILES(config.mk config.h examples/makewith/io/TestIO.conf examples/makewith/unsafeio/Unsafe.conf)
|
||||
|
||||
AC_OUTPUT
|
||||
|
||||
|
@ -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
|
Loading…
x
Reference in New Issue
Block a user