Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Connect to spawned server #19

Closed
phoboslab opened this issue Jul 21, 2016 · 2 comments
Closed

Connect to spawned server #19

phoboslab opened this issue Jul 21, 2016 · 2 comments

Comments

@phoboslab
Copy link

phoboslab commented Jul 21, 2016

Pardon my ignorance. I can't figure out how to actually connect to the spawned server. I've been previously using (without nodejs) xvfb-run -a some-binary – how would I translate that to this library?

I've tried the following

var headless = require('headless'),
var exec = require('child_process').exec;

headless(function(err, childProcess, servernum) {
    exec('xvfb-run -n '+ servernum + ' some-binary', error, stdout, stderr) {
        console.log('stdout:', stdout);
        console.log('stderr:', stderr);

        // kill the xvfb server - is this the correct place to do this?
        childProcess.kill();
    });
});

But this only emits "error: Xvfb failed to start", as if servernum were invalid.

@kesla
Copy link
Owner

kesla commented Jul 22, 2016

headless will start the xvfb instance so no need to do the exec('xvfb-run... stuff.

The servernum is invalid since there's been a server opened w that servernum already from the headless library.

@phoboslab
Copy link
Author

So I just do exec('some-binary) inside the headless() callback? Wow, sorry, that didn't cross my mind.

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants