builder: fix bug in run-or-bail
parent
35abb02630
commit
3b23cafefd
|
@ -59,6 +59,7 @@ VAR: stamp
|
|||
: bootstrap ( -- desc )
|
||||
<process*>
|
||||
bootstrap-cmd >>arguments
|
||||
+closed+ >>stdin
|
||||
"../boot-log" >>stdout
|
||||
+stdout+ >>stderr
|
||||
20 minutes>ms >>timeout
|
||||
|
@ -89,24 +90,8 @@ VAR: stamp
|
|||
|
||||
[ my-arch download-image ] [ "Image download error" print throw ] recover
|
||||
|
||||
! bootstrap [ "Bootstrap error" print "../boot-log" cat ] run-or-bail
|
||||
bootstrap [ "Bootstrap error" print "../boot-log" cat ] run-or-bail
|
||||
|
||||
! bootstrap
|
||||
! <process-stream> dup dispose process-stream-process wait-for-process
|
||||
! zero? not
|
||||
! [ "Bootstrap error" print "../boot-log" cat "bootstrap error" throw ]
|
||||
! when
|
||||
|
||||
[
|
||||
bootstrap
|
||||
<process-stream> dup dispose process-stream-process wait-for-process
|
||||
zero? not
|
||||
[ "bootstrap non-zero" throw ]
|
||||
when
|
||||
]
|
||||
[ "Bootstrap error" print "../boot-log" cat "bootstrap" throw ]
|
||||
recover
|
||||
|
||||
[ builder-test try-process ]
|
||||
[ "Builder test error" print throw ]
|
||||
recover
|
||||
|
|
|
@ -39,13 +39,14 @@ DEFER: to-strings
|
|||
|
||||
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
|
||||
TUPLE: process* arguments stdout stderr timeout ;
|
||||
TUPLE: process* arguments stdin stdout stderr timeout ;
|
||||
|
||||
: <process*> process* construct-empty ;
|
||||
|
||||
: >desc ( process* -- desc )
|
||||
H{ } clone
|
||||
over arguments>> [ +arguments+ swap put-at ] when*
|
||||
over stdin>> [ +stdin+ swap put-at ] when*
|
||||
over stdout>> [ +stdout+ swap put-at ] when*
|
||||
over stderr>> [ +stderr+ swap put-at ] when*
|
||||
over timeout>> [ +timeout+ swap put-at ] when*
|
||||
|
@ -73,8 +74,8 @@ TUPLE: process* arguments stdout stderr timeout ;
|
|||
: cat ( file -- ) <file-reader> contents print ;
|
||||
|
||||
: run-or-bail ( desc quot -- )
|
||||
[ [ try-process ] curry ]
|
||||
[ [ throw ] curry ]
|
||||
[ [ try-process ] curry ]
|
||||
[ [ throw ] compose ]
|
||||
bi*
|
||||
recover ;
|
||||
|
||||
|
|
Loading…
Reference in New Issue