#1599: testsuite timeout doesn't kill subprocesses on Windows
------------------------+---------------------------------------------------
 Reporter:  simonmar    |          Owner:  igloo     
     Type:  bug         |         Status:  new       
 Priority:  normal      |      Milestone:  6.8 branch
Component:  Test Suite  |        Version:  6.6.1     
 Severity:  normal      |     Resolution:            
 Keywords:              |     Difficulty:  Unknown   
 Testcase:              |   Architecture:  x86       
       Os:  Windows     |  
------------------------+---------------------------------------------------
Comment (by igloo):

 Using this python program:
 {{{
 #!/usr/bin/python

 from killableprocess import *
 from sys import argv

 p = Popen(args=argv[1])
 r = p.wait(timeout=1)
 print r
 }}}
 and this Haskell program:
 {{{
 import Foreign.C
 import System.Cmd
 import System.IO

 main :: IO ()
 main = do hSetBuffering stdout NoBuffering
           putStrLn "start main"
           -- rawSystem "c:/cygwin/bin/sh"
           --           ["-c", "echo wibble; sleep 3; echo flibble"]
           -- system "sh -c \"echo wibble; sleep 3; echo flibble\""
           withCString "sh -c \"echo wibble; sleep 3; echo flibble\"" s
           putStrLn "end main"

 foreign import ccall "stdlib.h system" s :: CString -> IO CInt
 }}}
 it doesn't seem to work (the "flibble" on the last line is printed after
 the command has terminated):
 {{{
 $ ghc --make Foo -fffi
 [1 of 1] Compiling Main             ( Foo.hs, Foo.o )
 Linking Foo.exe ...

 $ ./ptimeout.py ./Foo
 start main
 wibble
 -9

 $ flibble
 }}}
 Even with this C program:
 {{{
 #include <stdio.h>
 #include <stdlib.h>

 int main(void) {
       printf("start main\n");
       system("sh -c \"echo wibble; sleep 3; echo flibble\"");
       printf("end main\n");
 }
 }}}
 it doesn't seem to work right:
 {{{
 $ gcc c.c -o c

 $ ./ptimeout.py ./c
 start main
 wibble
 flibble
 -9

 $ ./ptimeout.py ./c
 start main
 wibble
 -9
 end main

 $ ./ptimeout.py ./c
 start main
 wibble
 -9
 }}}

 The C++ program that is linked to also doesn't work for me:
 {{{
 $ Debug/killableprocess.exe ./c
 start main
 end main

 $
 }}}

 I'll try to investigate further.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/1599#comment:2>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to