io.launcher.unix: sometimes both WIFEXITED and WIFSIGNALED would return true, and the wrong status would be reported

db4
Slava Pestov 2010-02-07 18:17:53 +13:00
parent 583262ca7b
commit e2500c14d2
2 changed files with 3 additions and 3 deletions

View File

@ -3,7 +3,7 @@ USING: io.files io.files.temp io.directories io.pathnames
tools.test io.launcher arrays io namespaces continuations math tools.test io.launcher arrays io namespaces continuations math
io.encodings.binary io.encodings.ascii accessors kernel io.encodings.binary io.encodings.ascii accessors kernel
sequences io.encodings.utf8 destructors io.streams.duplex locals sequences io.encodings.utf8 destructors io.streams.duplex locals
concurrency.promises threads unix.process calendar ; concurrency.promises threads unix.process calendar unix ;
[ ] [ [ ] [
[ "launcher-test-1" temp-file delete-file ] ignore-errors [ "launcher-test-1" temp-file delete-file ] ignore-errors
@ -134,7 +134,7 @@ concurrency.promises threads unix.process calendar ;
[ p fulfill ] [ wait-for-process s fulfill ] bi [ p fulfill ] [ wait-for-process s fulfill ] bi
] in-thread ] in-thread
p 1 seconds ?promise-timeout handle>> 9 kill drop p 1 seconds ?promise-timeout handle>> kill-process*
s ?promise 0 = s ?promise 0 =
] ]
] unit-test ] unit-test

View File

@ -91,7 +91,7 @@ M: unix kill-process* ( pid -- )
TUPLE: signal n ; TUPLE: signal n ;
: code>status ( code -- obj ) : code>status ( code -- obj )
dup WIFEXITED [ WEXITSTATUS ] [ WTERMSIG signal boa ] if ; dup WIFSIGNALED [ WTERMSIG signal boa ] [ WEXITSTATUS ] if ;
M: unix wait-for-processes ( -- ? ) M: unix wait-for-processes ( -- ? )
0 <int> -1 over WNOHANG waitpid 0 <int> -1 over WNOHANG waitpid