From 4bf1f38a67c270c60bd20ed72d4d4eb54edb4224 Mon Sep 17 00:00:00 2001 From: Anton Dyudin Date: Fri, 9 Mar 2018 12:47:45 -0800 Subject: [PATCH] factor out ERROR regex --- .travis/in-urbit.ls | 4 ++-- .travis/runner.ls | 5 ++--- .travis/test.ls | 4 ++-- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/.travis/in-urbit.ls b/.travis/in-urbit.ls index b60fe35e8..02d90cb20 100644 --- a/.travis/in-urbit.ls +++ b/.travis/in-urbit.ls @@ -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 diff --git a/.travis/runner.ls b/.travis/runner.ls index 6dab2af9d..742435bcb 100644 --- a/.travis/runner.ls +++ b/.travis/runner.ls @@ -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 + @pty.pipe (new stream-snitch re).once "match" resolve expect-immediate: (re)-> Promise.race [ @expect re diff --git a/.travis/test.ls b/.travis/test.ls index 89c9bd273..88e31b741 100644 --- a/.travis/test.ls +++ b/.travis/test.ls @@ -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