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

spawning a coffee child process doesn't work as expected #3427

Closed
paulpflug opened this issue Mar 19, 2014 · 9 comments
Closed

spawning a coffee child process doesn't work as expected #3427

paulpflug opened this issue Mar 19, 2014 · 9 comments

Comments

@paulpflug
Copy link

I have two files

test.coffee

spawn = require('child_process').spawn
child = spawn("coffee",["subtest.coffee"])
child.stdout.on 'data', (data) -> 
  console.log('stdout: ' + data)
console.log(child.pid)

and
subtest.coffee

console.log(process.pid)

Output when running coffee test.coffee

6596
stdout: 6436

The pids should match..
So coffee makes its own child process?
The problem is, that the child process cannot be killed..
See here
and here

@paulpflug
Copy link
Author

could be windows specific..

@MetaMemoryT
Copy link

I am also running on windows, what could be a work around to kill the coffee child process?

The child process is created here in forkNode:
https://github.com/jashkenas/coffeescript/blob/master/src/command.coffee

@paulpflug
Copy link
Author

The only workaround I know is to call
node {{path-to-coffee}} script.coffee
instead of
coffee script.coffee

this will give the right child id

@akre54
Copy link

akre54 commented Jun 23, 2014

node $(which coffee) script.coffee on bash.

@vendethiel
Copy link
Collaborator

@akre54 Are you experiencing this problem on non-windows ?

@akre54
Copy link

akre54 commented Jun 23, 2014

Nope, just pointing out a nice one-liner to the above :)

@vendethiel
Copy link
Collaborator

Yeah, but that's a windows-specific problem, so it probably won't be that useful :)

@akre54
Copy link

akre54 commented Jun 23, 2014

Yeah, there's an equivalent in powershell (lemme look it up, was on an older gulp thread).

EDIT: http://stackoverflow.com/questions/304319/is-there-an-equivalent-of-which-on-the-windows-command-line

@GeoffreyBooth
Copy link
Collaborator

The coffee command is intended primarily for compiling and secondarily for debugging, not as a replacement for the node command that is intended to run code.

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

5 participants