2018-03-08 03:00:07 +03:00
|
|
|
require! <[ stream-snitch once ]>
|
2017-12-01 08:25:19 +03:00
|
|
|
pty = require \pty.js
|
|
|
|
|
2017-12-02 00:00:10 +03:00
|
|
|
urbit =
|
2017-12-01 08:44:10 +03:00
|
|
|
# TODO abort on failure
|
2017-12-09 02:56:33 +03:00
|
|
|
pty.spawn 'urbit' <[-B urbit.pill -A .. -cFI zod zod]>
|
2017-12-01 08:25:19 +03:00
|
|
|
.on \data -> process.stdout.write it
|
2018-03-08 03:00:07 +03:00
|
|
|
|
|
|
|
console.log "FIXME Running Ubuntu 14.04, which causes a libtinfo version info warning. Should update to 16.04.\n"
|
|
|
|
|
|
|
|
|
2017-12-02 06:52:35 +03:00
|
|
|
urbit.on \exit (code)->
|
|
|
|
console.log "\nnode: urbit exited with code #code\n"
|
|
|
|
process.exit code
|
|
|
|
|
2017-12-02 06:20:24 +03:00
|
|
|
process.on \exit -> urbit.write '\04' # send EOF to gracefully checkpoint
|
2018-03-08 03:00:07 +03:00
|
|
|
|
|
|
|
|
|
|
|
on-next = (re,cb)->
|
|
|
|
urbit.pipe (new stream-snitch re).on \match once cb
|
|
|
|
|
|
|
|
on-next /\n(\/~|ford: )/ ->
|
|
|
|
console.log "\n\n---\nnode: detected error\n---\n\n"
|
|
|
|
set-timeout (-> process.exit 1), 1000
|
|
|
|
|
|
|
|
<- on-next /dojo> /
|
|
|
|
urbit.write "%got-dojo\r"
|
|
|
|
<- on-next /%got-dojo/
|
|
|
|
|
|
|
|
console.log "\n\n---\nnode: STUB insert tests here\n---\n\n"
|
|
|
|
set-timeout (-> process.exit 0), 1000
|