-USING: accessors arrays assocs calendar continuations
-environment eval hashtables io io.directories
-io.encodings.ascii io.encodings.utf8 io.files io.files.temp io.launcher
-io.launcher.windows io.pathnames kernel math namespaces parser
-sequences splitting system tools.test combinators.short-circuit ;
+USING: accessors arrays assocs calendar
+combinators.short-circuit continuations environment eval
+hashtables io io.directories io.encodings.ascii
+io.encodings.utf8 io.files io.files.temp io.files.unique
+io.launcher io.launcher.windows io.pathnames kernel math
+namespaces parser sequences splitting system tools.test ;
 IN: io.launcher.windows.tests
 
 [ "hello world" ] [ { "hello" "world" } join-arguments ] unit-test

    launcher-test-path [
        <process>
            console-vm "-script" "stderr.factor" 3array >>command
            "out.txt" temp-file >>stdout
            "err.txt" temp-file >>stderr
        try-process
    ] with-directory
] unit-test

[ "output" ] [
    "out.txt" temp-file ascii file-lines first
] unit-test

[ "error" ] [
    "err.txt" temp-file ascii file-lines first
] unit-test

[ ] [
    launcher-test-path [
        <process>
            console-vm "-script" "stderr.factor" 3array >>command
            "out.txt" temp-file >>stdout
            +stdout+ >>stderr
        try-process
    ] with-directory
] unit-test

[ "outputerror" ] [
    "out.txt" temp-file ascii file-lines first
] unit-test

[ "output" ] [
    launcher-test-path [
        <process>
            console-vm "-script" "stderr.factor" 3array >>command
            "err2.txt" temp-file >>stderr
        utf8 <process-reader> stream-lines first
    ] with-directory
] unit-test

[ "error" ] [
    "err2.txt" temp-file ascii file-lines first
] unit-test



: console-vm ( -- path )
    vm ".exe" ?tail [ ".com" append ] when ;

SYMBOLS: out-path err-path ;

[ ] [
    <process>
        console-vm "-run=hello-world" 2array >>command
        "out.txt" unique-file [ out-path set-global ] keep >>stdout
    try-process
] unit-test

[ "Hello world" ] [
    out-path get-global ascii file-lines first
] unit-test

[ "IN: scratchpad " ] [
