1 IN: io.unix.launcher.tests
2 USING: io.files tools.test io.launcher arrays io namespaces
3 continuations math io.encodings.binary io.encodings.ascii
4 accessors kernel sequences io.encodings.utf8 destructors
5 io.streams.duplex locals concurrency.promises threads
9 [ "launcher-test-1" temp-file delete-file ] ignore-errors
14 "launcher-test-1" temp-file
19 [ t ] [ "launcher-test-1" temp-file exists? ] unit-test
22 [ "launcher-test-1" temp-file delete-file ] ignore-errors
27 "echo Hello" >>command
28 "launcher-test-1" temp-file >>stdout
34 "launcher-test-1" temp-file
36 ascii <process-reader> contents
40 [ "launcher-test-1" temp-file delete-file ] ignore-errors
47 "launcher-test-1" temp-file >>stdout
53 "launcher-test-1" temp-file
55 ascii <process-reader> contents
60 "launcher-test-1" temp-file binary <file-appender> [
63 "echo Hello" >>command
69 [ "Hello\nHello\n" ] [
71 "launcher-test-1" temp-file
73 ascii <process-reader> contents
79 { { "A" "B" } } >>environment
80 ascii <process-reader> lines
87 { { "A" "B" } } >>environment
88 +replace-environment+ >>environment-mode
89 ascii <process-reader> lines
94 [ "aloha" delete-file ] ignore-errors
96 { "echo" "hi" } >>command
100 temp-directory "aloha" append-path
104 [ "append-test" temp-file delete-file ] ignore-errors
110 "append-test" temp-file <appender> >>stdout
113 "append-test" temp-file utf8 file-contents
116 [ t ] [ "ls" utf8 <process-stream> contents >boolean ] unit-test
118 [ "Hello world.\n" ] [
119 "cat" utf8 <process-stream> [
120 "Hello world.\n" write
121 output-stream get dispose
122 input-stream get contents
126 ! Killed processes were exiting with code 0 on FreeBSD
128 [let | p [ <promise> ]
131 "sleep 1000" run-detached
132 [ p fulfill ] [ wait-for-process s fulfill ] bi
135 p ?promise handle>> 9 kill drop