juliangruber / browser-run

Run code inside a browser from the command line
447 stars 62 forks source link

No output #153

Open adjenks opened 4 years ago

adjenks commented 4 years ago

When I run the example echo "console.log('Hey from ' + location); window.close()" | browser-run I get no output, but also no error message. How can I debug this?

adjenks commented 4 years ago

Running another test:

test.js:

var run = require('browser-run');
var browser = run();
browser.pipe(process.stdout);
browser.end('console.log(location); window.close()');
process.stdout.write('hi');// Check to see if console output is working

bash: $ node test/test.js

hi

It should also output the location but does not. No errors are reported.

adjenks commented 4 years ago

I tried to run electron on my console but it said I was missing a library. Perhaps browser-run fails to detect when electron fails to run.

error while loading shared libraries: libffmpeg.so

ashnur commented 4 years ago

Have you installed browser-run globally?

adjenks commented 4 years ago

@ashnur I just ran it using a global installation, same results. Before it was not --global.

ashnur commented 4 years ago

Weird. echo "console.log('Hey from ' + location); window.close()" | browser-run WFM on linux

maybe try with a different browser or try the development version (cloning this repo and try running the tests locally).

Also, if you share more information about the context, I am sure more people will likely to chime in with suggestions.

adjenks commented 4 years ago

The thing is, I understand that electron will not run. So that's probably the hangup. I would like to know however why it doesn't output any error message. How can I get more debug info from browser-run?

juliangruber commented 4 years ago

This method does the actual spawning:

https://github.com/juliangruber/electron-stream/blob/0e25d5571b9dfaf4e828ab372c6cdad9b3b5f7f1/index.js#L79-L97

I guess we could read from stderr here to detect failures like this? Or we could make it so it throws an error if no "message" was received before the "exit", which is a more general solution.

sfriesel commented 4 years ago

I'm having the same issue, using browser-run indirectly through tape-run. Electron fails to start (in my case due to libgconf-2.so.4: cannot open shared object file: No such file or directory) when I'm executing it directly, but browser-run provides no output.