detect boot error

This commit is contained in:
Anton Dyudin 2018-03-09 11:55:07 -08:00
parent 6e3d42aad6
commit 31715d7d36
2 changed files with 13 additions and 8 deletions

View File

@ -13,12 +13,12 @@ export class Urbit
#
process.on \exit ~> @pty.write '\04' # send EOF to gracefully checkpoint
#
note: -> console.log "\nnode:".blue, it
warn: -> console.log "\nnode:".red, it
note: (...args)-> console.log "\nnode:".blue, ...args
warn: (...args)-> console.log "\nnode:".red, ...args
wait-silent: ~> # this feels hacky
new Promise (resolve)~>
a = set-interval ~>
if Date.now! > @last-output + 1000
if Date.now! > @last-output + 2000
clear-interval a
resolve @last-output
, 200

View File

@ -4,10 +4,15 @@ urbit = new Urbit <[-B urbit.pill -A .. -cFI zod zod]>
Promise.resolve urbit
.then (urb)->
urb.note "Booting urbit"
# TODO exit on ford stack trace
<- urb.expect /dojo> / .then
<- urb.expect-echo "%dojo-booted" .then
urb
Promise.race [
urb.expect-error!then ->
urb.warn "Error detected"
throw Error "Stack trace while booting"
, do
<- urb.expect /dojo> / .then
<- urb.expect-echo "%dojo-booted" .then
urb
]
.then (urb)->
urb.note "Testing compilation"
# TODO tally ford stack traces
@ -28,5 +33,5 @@ Promise.resolve urbit
urbit.exit 0
.catch (err)->
<- urbit.wait-silent!then # assumptions?
urbit.warn err
urbit.warn "Test aborted:" err
urbit.exit 1