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

Upgrade to child_process.spawn #12

Open
khilnani opened this issue Dec 24, 2012 · 0 comments
Open

Upgrade to child_process.spawn #12

khilnani opened this issue Dec 24, 2012 · 0 comments

Comments

@khilnani
Copy link
Owner

From Felix -

rather than use exec I think you should use spawn.
this is how I spawn scsynth from inside supercollider.js

I will do the same thing for sclang when I get around to it.
then it should be easy to use this from other projects.

something like
scjs = requires("supercolliderjs");

sclang = new new SCLang();
sclang.start(function() {
// language is started now
});
sclang.on("quit",function() { });
etc.

here's the version for a local scsynth: LocalServer()

https://github.com/crucialfelix/supercolliderjs/blob/master/lib/localserver.js

var spawn = require('child_process').spawn;

    console.log( this.options.cwd + this.options.cmd );
    this.process = spawn(this.options.cwd + this.options.cmd,this.args(),
        {
            stdio: ['pipe', 'pipe', 'pipe'],
            cwd: this.options.cwd

        });
    console.log("spawned " + this.process.pid);
    this.process.on('exit',function(code){
        console.log("Server exited " + code);
    });
    this.process.stdout.on('data',function(data){
        console.log(" " + data);
    });
    this.process.stderr.on('data',function(data){
        console.log("! " + data);
    });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant