restructure test script to be flatter
/ more like build-pill
-require! \stream-snitch
+require! <[ stream-snitch once ]>
pty = require \pty.js
urbit =
@@ -6,27 +6,26 @@ urbit =
pty.spawn 'urbit' <[-B urbit.pill -A .. -cFI zod zod]>
.on \data -> process.stdout.write it
+console.log "FIXME Running Ubuntu 14.04, which causes a libtinfo version info warning. Should update to 16.04.\n"
+
+
urbit.on \exit (code)->
console.log "\nnode: urbit exited with code #code\n"
process.exit code
-console.log "FIXME Running Ubuntu 14.04, which causes a libtinfo version info warning. Should update to 16.04.\n"
+process.on \exit -> urbit.write '\04' # send EOF to gracefully checkpoint
+
-fin = no
-urbit.pipe (new stream-snitch /dojo> /g).on \match ->
- return if fin
- fin := yes
- console.log "\n\n---\nnode: got dojo!\n---\n\n"
- set-timeout (-> process.exit 0), 1000 # should probably test further
+on-next = (re,cb)->
+ urbit.pipe (new stream-snitch re).on \match once cb
-urbit.pipe (new stream-snitch /\n(\/~|ford: )/g).on \match ->
- return if fin
- fin := yes
+on-next /\n(\/~|ford: )/ ->
console.log "\n\n---\nnode: detected error\n---\n\n"
set-timeout (-> process.exit 1), 1000
-set-timeout ...
- -> console.log "\n\n---\nnode: timed out after 5 min\n---"
- 5*60000
+<- on-next /dojo> /
+urbit.write "%got-dojo\r"
+<- on-next /%got-dojo/
-process.on \exit -> urbit.write '\04' # send EOF to gracefully checkpoint
+console.log "\n\n---\nnode: STUB insert tests here\n---\n\n"
+set-timeout (-> process.exit 0), 1000
