gf3 / sandbox

A nifty JavaScript sandbox for Node.js
ISC License
844 stars 123 forks source link

Handling timeout with multiple child processes. #35

Closed misotrnka closed 9 years ago

misotrnka commented 9 years ago

Timeout is not functioning in cases, where run() is called multiple times on a single instance of Sandbox. The example.js is one such case - if you just clone the repo and run the example, as suggested in the readme, the example #5 never finishes and the example keeps hanging.

I'm suggesting to fix this by attaching the timer directly to the child process. Therefore, the child process can be accessed from the Timeout callback function and terminated properly.

gf3 commented 9 years ago

Thank you!