ssbc / ssb-server

The gossip and replication server for Secure Scuttlebutt - a distributed social network
1.69k stars 164 forks source link

test/bin closes terminal on failure #565

Open dominictarr opened 6 years ago

dominictarr commented 6 years ago

If test/bin.js fails, it closes the terminal that it's running in! that makes it very difficult to debug...

I'm guessing it's something to do with the kill %1 thing

I was trying to use it to debug my problem here https://github.com/ssbc/multiserver/pull/25#issuecomment-433758596 basically I need to listen on an address that will work for local network and localhost. but the test only covers listening on explicit addresses.

dominictarr commented 6 years ago

I also noticed that if I commented the whole line with kill %1 then the test would wait for me to do ctrl-c before advancing.

@regular

dominictarr commented 6 years ago

hmm, this seems to only be the case when it's run directly node test/bin.js and not within a script!

...

Okay I fixed it!

diff --git a/test/bin.js b/test/bin.js
index 3a17f50..c022b84 100644
--- a/test/bin.js
+++ b/test/bin.js
@@ -28,9 +28,10 @@ function sbot(t, argv, opts) {
     ' & read dummy; echo killing sbot; kill %1; wait %1' 
   ], Object.assign({
     env: Object.assign({}, process.env, {ssb_appname: 'test'}),
-    stdio: ['pipe', 'inherit', 'inherit']
   }, opts))

+  sh.stdout.pipe(process.stdout)
+  sh.stderr.pipe(process.stderr)
   return function end() {
     console.log('ending ...')
dominictarr commented 6 years ago

no maybe i didn't fix it... anyway, this seems like a rather fragile way to run this test

dominictarr commented 6 years ago

my fix is here: https://github.com/ssbc/scuttlebot/pull/566

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.