mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-11-11 04:48:00 +03:00
factor out ERROR regex
This commit is contained in:
parent
31715d7d36
commit
4bf1f38a67
@ -1,10 +1,10 @@
|
||||
require! <[ split ]>
|
||||
{through} = require 'promise-streams'
|
||||
{Urbit} = require './runner.ls'
|
||||
{Urbit,ERROR} = require './runner.ls'
|
||||
|
||||
urbit = new Urbit process.argv[2 to]
|
||||
|
||||
urbit.expect-error!then -> process.exit 1
|
||||
urbit.expect ERROR .then -> process.exit 1
|
||||
|
||||
<- urbit.expect /dojo> / .then
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
require! <[ stream-snitch colors escape-string-regexp ]>
|
||||
pty = require \pty.js
|
||||
|
||||
export ERROR = /(ford: |\r\x1b\[K\/~)/
|
||||
export class Urbit
|
||||
(args)->
|
||||
@stdout = process.stdout # overridable
|
||||
@ -24,9 +25,7 @@ export class Urbit
|
||||
, 200
|
||||
expect: (re)~>
|
||||
new Promise (resolve)~>
|
||||
#@listeners.push
|
||||
@pty.pipe (new stream-snitch re).once "match" resolve
|
||||
expect-error: -> @expect /(ford: |\r\x1b\[K\/~)/ #ALT if-error
|
||||
expect-immediate: (re)->
|
||||
Promise.race [
|
||||
@expect re
|
||||
|
@ -1,11 +1,11 @@
|
||||
{Urbit} = require './runner.ls'
|
||||
{Urbit,ERROR} = require './runner.ls'
|
||||
|
||||
urbit = new Urbit <[-B urbit.pill -A .. -cFI zod zod]>
|
||||
Promise.resolve urbit
|
||||
.then (urb)->
|
||||
urb.note "Booting urbit"
|
||||
Promise.race [
|
||||
urb.expect-error!then ->
|
||||
urb.expect ERROR .then ->
|
||||
urb.warn "Error detected"
|
||||
throw Error "Stack trace while booting"
|
||||
, do
|
||||
|
Loading…
Reference in New Issue
Block a user