2008-03-04 16:07:57 -05:00
|
|
|
IN: io.unix.launcher.tests
|
|
|
|
USING: io.files tools.test io.launcher arrays io namespaces
|
2008-03-18 17:01:14 -04:00
|
|
|
continuations math io.encodings.binary io.encodings.ascii
|
2008-03-06 21:44:52 -05:00
|
|
|
accessors kernel sequences ;
|
2008-03-04 16:07:57 -05:00
|
|
|
|
|
|
|
[ ] [
|
|
|
|
[ "launcher-test-1" temp-file delete-file ] ignore-errors
|
|
|
|
] unit-test
|
|
|
|
|
|
|
|
[ ] [
|
|
|
|
"touch"
|
|
|
|
"launcher-test-1" temp-file
|
|
|
|
2array
|
|
|
|
try-process
|
|
|
|
] unit-test
|
|
|
|
|
|
|
|
[ t ] [ "launcher-test-1" temp-file exists? ] unit-test
|
|
|
|
|
|
|
|
[ ] [
|
|
|
|
[ "launcher-test-1" temp-file delete-file ] ignore-errors
|
|
|
|
] unit-test
|
|
|
|
|
|
|
|
[ ] [
|
2008-03-06 21:44:52 -05:00
|
|
|
<process>
|
|
|
|
"echo Hello" >>command
|
|
|
|
"launcher-test-1" temp-file >>stdout
|
|
|
|
try-process
|
2008-03-04 16:07:57 -05:00
|
|
|
] unit-test
|
|
|
|
|
|
|
|
[ "Hello\n" ] [
|
|
|
|
"cat"
|
|
|
|
"launcher-test-1" temp-file
|
|
|
|
2array
|
2008-03-04 19:12:01 -05:00
|
|
|
ascii <process-stream> contents
|
2008-03-04 16:07:57 -05:00
|
|
|
] unit-test
|
|
|
|
|
2008-03-18 04:27:14 -04:00
|
|
|
[ f ] [
|
2008-03-06 21:44:52 -05:00
|
|
|
<process>
|
2008-03-04 16:07:57 -05:00
|
|
|
"cat"
|
|
|
|
"launcher-test-1" temp-file
|
2008-03-06 21:44:52 -05:00
|
|
|
2array >>command
|
|
|
|
+inherit+ >>stdout
|
|
|
|
ascii <process-stream> contents
|
2008-03-04 16:07:57 -05:00
|
|
|
] unit-test
|
|
|
|
|
|
|
|
[ ] [
|
|
|
|
[ "launcher-test-1" temp-file delete-file ] ignore-errors
|
|
|
|
] unit-test
|
|
|
|
|
|
|
|
[ ] [
|
2008-03-06 21:44:52 -05:00
|
|
|
<process>
|
|
|
|
"cat" >>command
|
|
|
|
+closed+ >>stdin
|
|
|
|
"launcher-test-1" temp-file >>stdout
|
|
|
|
try-process
|
2008-03-04 16:07:57 -05:00
|
|
|
] unit-test
|
|
|
|
|
2008-03-18 04:27:14 -04:00
|
|
|
[ f ] [
|
2008-03-04 16:07:57 -05:00
|
|
|
"cat"
|
|
|
|
"launcher-test-1" temp-file
|
|
|
|
2array
|
2008-03-04 19:12:01 -05:00
|
|
|
ascii <process-stream> contents
|
2008-03-04 16:07:57 -05:00
|
|
|
] unit-test
|
|
|
|
|
|
|
|
[ ] [
|
|
|
|
2 [
|
2008-03-18 17:01:14 -04:00
|
|
|
"launcher-test-1" temp-file binary <file-appender> [
|
2008-03-06 21:44:52 -05:00
|
|
|
<process>
|
|
|
|
swap >>stdout
|
|
|
|
"echo Hello" >>command
|
|
|
|
try-process
|
2008-03-04 16:07:57 -05:00
|
|
|
] with-disposal
|
|
|
|
] times
|
|
|
|
] unit-test
|
|
|
|
|
|
|
|
[ "Hello\nHello\n" ] [
|
|
|
|
"cat"
|
|
|
|
"launcher-test-1" temp-file
|
|
|
|
2array
|
2008-03-04 19:12:01 -05:00
|
|
|
ascii <process-stream> contents
|
2008-03-04 16:07:57 -05:00
|
|
|
] unit-test
|
2008-03-06 21:44:52 -05:00
|
|
|
|
|
|
|
[ t ] [
|
|
|
|
<process>
|
|
|
|
"env" >>command
|
|
|
|
{ { "A" "B" } } >>environment
|
2008-03-18 17:01:14 -04:00
|
|
|
ascii <process-stream> lines
|
2008-03-06 21:44:52 -05:00
|
|
|
"A=B" swap member?
|
|
|
|
] unit-test
|
|
|
|
|
|
|
|
[ { "A=B" } ] [
|
|
|
|
<process>
|
|
|
|
"env" >>command
|
|
|
|
{ { "A" "B" } } >>environment
|
|
|
|
+replace-environment+ >>environment-mode
|
2008-03-18 17:01:14 -04:00
|
|
|
ascii <process-stream> lines
|
2008-03-06 21:44:52 -05:00
|
|
|
] unit-test
|