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