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:
shelarcy 2005-05-21 11:23:18 +00:00
parent 685ba637b6
commit 491477aeac
5 changed files with 18 additions and 3 deletions

View File

@ -79,6 +79,8 @@ clean:
find examples -name '*.o' -exec rm {} \; find examples -name '*.o' -exec rm {} \;
find examples -name '*.core' -exec rm {} \; find examples -name '*.core' -exec rm {} \;
find examples -name 'package.conf' -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/lib-plugs/plugs
rm -rf examples/hmake/one-shot/runplugs rm -rf examples/hmake/one-shot/runplugs
rm -f EvalHaskell.h rm -f EvalHaskell.h

5
configure vendored
View File

@ -3036,7 +3036,8 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' 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 cat >confcache <<\_ACEOF
@ -3592,6 +3593,8 @@ do
# Handling of arguments. # Handling of arguments.
"config.mk" ) CONFIG_FILES="$CONFIG_FILES config.mk" ;; "config.mk" ) CONFIG_FILES="$CONFIG_FILES config.mk" ;;
"config.h" ) CONFIG_FILES="$CONFIG_FILES config.h" ;; "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:$LINENO: error: invalid argument: $ac_config_target" >&5
echo "$as_me: error: invalid argument: $ac_config_target" >&2;} echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
{ (exit 1); exit 1; }; };; { (exit 1); exit 1; }; };;

View File

@ -218,7 +218,8 @@ AC_SUBST(SYMS)
AC_PROG_INSTALL 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 AC_OUTPUT

View File

@ -13,5 +13,10 @@ resource = testio { field = date }
-- call a shell command , returning it's output -- call a shell command , returning it's output
-- --
date :: IO String 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 hGetLine out

View File

@ -10,7 +10,11 @@ resource = unsafe { field = date }
-- illustrates the use of the devil's work -- illustrates the use of the devil's work
date :: String date :: String
date = unsafePerformIO $ do date = unsafePerformIO $ do
#if !defined(CYGWIN) || !defined(__MINGW32__)
(_,outh,_,proc) <- runInteractiveProcess "date" [] Nothing Nothing (_,outh,_,proc) <- runInteractiveProcess "date" [] Nothing Nothing
#else
(_,outh,_,proc) <- runInteractiveProcess "@PREFIX@/../../bin/date" [] Nothing Nothing
#endif
waitForProcess proc waitForProcess proc
s <- hGetContents outh s <- hGetContents outh
return s return s