From df4fad9908e013d17bae8fd45770111102dda704 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Tue, 12 May 2009 05:16:19 -0500 Subject: [PATCH] Move try-output-process from mason.common to io.launcher --- basis/io/launcher/launcher.factor | 27 +++++++++++++++++++++------ extra/mason/common/common.factor | 12 ------------ 2 files changed, 21 insertions(+), 18 deletions(-) diff --git a/basis/io/launcher/launcher.factor b/basis/io/launcher/launcher.factor index 838c09c657..7451499978 100755 --- a/basis/io/launcher/launcher.factor +++ b/basis/io/launcher/launcher.factor @@ -1,11 +1,11 @@ ! Copyright (C) 2008 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. -USING: system kernel namespaces strings hashtables sequences -assocs combinators vocabs.loader init threads continuations -math accessors concurrency.flags destructors environment -io io.encodings.ascii io.backend io.timeouts io.pipes -io.pipes.private io.encodings io.streams.duplex io.ports -debugger prettyprint summary calendar ; +USING: system kernel namespaces strings hashtables sequences assocs +combinators vocabs.loader init threads continuations math accessors +concurrency.flags destructors environment io io.encodings.ascii +io.backend io.timeouts io.pipes io.pipes.private io.encodings +io.encodings.utf8 io.streams.duplex io.ports debugger prettyprint +summary calendar ; IN: io.launcher TUPLE: process < identity-tuple @@ -254,6 +254,21 @@ M: object run-pipeline-element swap [ with-stream ] dip 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 + [ stream-contents ] [ dup wait-for-process ] bi* + 0 = [ 2drop ] [ output-process-error ] if ; + : notify-exit ( process status -- ) >>status [ processes get delete-at* drop [ resume ] each ] keep diff --git a/extra/mason/common/common.factor b/extra/mason/common/common.factor index b7545a3c9e..a743c3fe9a 100755 --- a/extra/mason/common/common.factor +++ b/extra/mason/common/common.factor @@ -10,18 +10,6 @@ IN: mason.common 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 - [ stream-contents ] [ dup wait-for-process ] bi* - 0 = [ 2drop ] [ output-process-error ] if ; - HOOK: really-delete-tree os ( path -- ) M: windows really-delete-tree