I ran your code and I get the same error (libev epoll_wait)

This may be a platform specific thing :/

On Saturday, May 26, 2012 11:42:49 AM UTC-4, Oliver Leics wrote:
>
> On Sat, May 26, 2012 at 4:45 PM, Roman Shtylman <[email protected]> 
> wrote: 
> > https://gist.github.com/1920998 
> > 
> > If you run the above code with "node bad_file_descriptor.js sample.js" 
> and 
> > then send a SIGUSR1 to the parent process it will cause an error: 
> > (libev) epoll_wait: Bad file descriptor 
> > 
> > I think this is related to the fact that on restart, the stdout, etc are 
> no 
> > longer available since it has been effectively detached from the 
> terminal. 
> > Thus I am looking for a way to not use the parents stdout/in/err 
>
> I rewrote the gist a bit to make it run on a windows-box. I had to 
> remove all process.on('SIG*', ...) lines, as they are not supported 
> for windows. 
>
> If I then kill the child-process from within the parent-process, it 
> restarts just fine. Even if I kill the child-process via kill pid on 
> the commandline, it restarts fine. 
>
> The code based on the above gist: 
>
> ``` 
> var cp = require('child_process') 
>   , path = require('path') 
>   , args = process.argv.slice(0) 
>   , node_path = args.shift() 
>   , self_path = path.resolve(process.cwd, args.shift()) 
>   ; 
>
> console.log(node_path, self_path, args) 
>
> // Detach 
> if(!process.send) { 
>   cp.fork(self_path, args, { 
>     env: process.env 
>   }) 
>   process.exit(0) 
> } 
>
> // Starts the script 
> var script = args.shift() 
>   , child 
>
> function startChild() { 
>   child = cp.fork(script, args) 
>   child.on('exit', function() { 
>     process.nextTick(startChild) 
>   }) 
> } 
>
> function stopChild() { 
>   child.kill() 
>   child = null 
> } 
>
> startChild() 
>
> // Kill the child every three seconds 
> setInterval(function() { 
>   stopChild() 
> }, 3000) 
> ``` 
>
> BTW: I did not know that this works :-) 
>

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
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 post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply via email to