child_process pause/resume

167 views
Skip to first unread message

Steffen Schorling

unread,
Dec 1, 2014, 10:16:53 AM12/1/14
to nod...@googlegroups.com
Hallo
is it possible to set a child_process.fork() on "pause" and later resume it ?

I down´t want the dirty way over a wile loop.

Matt

unread,
Dec 1, 2014, 1:13:30 PM12/1/14
to nod...@googlegroups.com
You could send SIGSTOP to the process. This will not work on Windows.

But what are your actual requirements here to stop the process?

--
Job board: http://jobs.nodejs.org/
New group rules: https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
---
You received this message because you are subscribed to the Google Groups "nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+un...@googlegroups.com.
To post to this group, send email to nod...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/d0acc822-8385-4572-9480-aa94ef395f41%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Steffen Schorling

unread,
Dec 2, 2014, 3:12:41 AM12/2/14
to nod...@googlegroups.com
I want to sep through my child_process code like a debugger.

I habve try it with the bild in debugger but how can i concrol the debugger from the parent process ?

 

Andrey

unread,
Dec 2, 2014, 11:22:51 PM12/2/14
to nod...@googlegroups.com

I want to sep through my child_process code like a debugger.
I read this as "I want to have link between child and parent and control logic of the child".
With child_process.fork() you already have this link, exposed as on('message') and send(message


I habve try it with the bild in debugger but how can i concrol the debugger from the parent process ?

Yes, you can (though I doubt it's a good solution for your problem)

1) spawn your child with debugger enabled 

   var child = spawn('node', ['--debug-brk', 'script.js', 'some', 'params']);

2) connect debugger client from parent:

var DebuggerClient = require('_debugger').Client;
var dc = new DebuggerClient();
dc.connect(5858);

3) add some breakpoints to your script with "debugger" keyword or programmitically with dc.setBreakpoint()

4) drive your it with calls to dc.step(), dc.recContinue() and by reacting on break events:  
dc.on('break', function(resp) { /* your child stopped */ });

Reply all
Reply to author
Forward
0 new messages