Move try-output-process from mason.common to io.launcher
parent
b45d901e47
commit
df4fad9908
|
@ -1,11 +1,11 @@
|
||||||
! Copyright (C) 2008 Slava Pestov.
|
! Copyright (C) 2008 Slava Pestov.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: system kernel namespaces strings hashtables sequences
|
USING: system kernel namespaces strings hashtables sequences assocs
|
||||||
assocs combinators vocabs.loader init threads continuations
|
combinators vocabs.loader init threads continuations math accessors
|
||||||
math accessors concurrency.flags destructors environment
|
concurrency.flags destructors environment io io.encodings.ascii
|
||||||
io io.encodings.ascii io.backend io.timeouts io.pipes
|
io.backend io.timeouts io.pipes io.pipes.private io.encodings
|
||||||
io.pipes.private io.encodings io.streams.duplex io.ports
|
io.encodings.utf8 io.streams.duplex io.ports debugger prettyprint
|
||||||
debugger prettyprint summary calendar ;
|
summary calendar ;
|
||||||
IN: io.launcher
|
IN: io.launcher
|
||||||
|
|
||||||
TUPLE: process < identity-tuple
|
TUPLE: process < identity-tuple
|
||||||
|
@ -254,6 +254,21 @@ M: object run-pipeline-element
|
||||||
swap [ with-stream ] dip
|
swap [ with-stream ] dip
|
||||||
wait-for-success ; inline
|
wait-for-success ; inline
|
||||||
|
|
||||||
|
ERROR: output-process-error { output string } { process process } ;
|
||||||
|
|
||||||
|
M: output-process-error error.
|
||||||
|
[ "Process:" print process>> . nl ]
|
||||||
|
[ "Output:" print output>> print ]
|
||||||
|
bi ;
|
||||||
|
|
||||||
|
: try-output-process ( command -- )
|
||||||
|
>process
|
||||||
|
+stdout+ >>stderr
|
||||||
|
+closed+ >>stdin
|
||||||
|
utf8 <process-reader*>
|
||||||
|
[ stream-contents ] [ dup wait-for-process ] bi*
|
||||||
|
0 = [ 2drop ] [ output-process-error ] if ;
|
||||||
|
|
||||||
: notify-exit ( process status -- )
|
: notify-exit ( process status -- )
|
||||||
>>status
|
>>status
|
||||||
[ processes get delete-at* drop [ resume ] each ] keep
|
[ processes get delete-at* drop [ resume ] each ] keep
|
||||||
|
|
|
@ -10,18 +10,6 @@ IN: mason.common
|
||||||
|
|
||||||
SYMBOL: current-git-id
|
SYMBOL: current-git-id
|
||||||
|
|
||||||
ERROR: output-process-error { output string } { process process } ;
|
|
||||||
|
|
||||||
M: output-process-error error.
|
|
||||||
[ "Process:" print process>> . nl ]
|
|
||||||
[ "Output:" print output>> print ]
|
|
||||||
bi ;
|
|
||||||
|
|
||||||
: try-output-process ( command -- )
|
|
||||||
>process +stdout+ >>stderr utf8 <process-reader*>
|
|
||||||
[ stream-contents ] [ dup wait-for-process ] bi*
|
|
||||||
0 = [ 2drop ] [ output-process-error ] if ;
|
|
||||||
|
|
||||||
HOOK: really-delete-tree os ( path -- )
|
HOOK: really-delete-tree os ( path -- )
|
||||||
|
|
||||||
M: windows really-delete-tree
|
M: windows really-delete-tree
|
||||||
|
|
Loading…
Reference in New Issue