Quantcast
Channel: Node.js Tools for Visual Studio
Viewing all articles
Browse latest Browse all 4630

Commented Issue: Program under debug never exits. [1807]

$
0
0
On the for loop on line 7 put a breakpoint. Run F5.

Program will never exit. Run without debugging it will end.
```
var cluster = require('cluster');
var http = require('http');
var numCPUs = require('os').cpus().length;

if (cluster.isMaster) {
// Fork workers.
for (var i = 0; i < numCPUs; i++) {
cluster.fork();
}

cluster.on('exit', function (worker, code, signal) {
console.log('worker ' + worker.process.pid + ' died');
});
} else {
// Workers can share any TCP connection
// In this case its a HTTP server
console.log("entered worker")
for(var i = 0; i < 10; i++)
console.log("RAND" + Math.random)
for (var i = 10; i < 100; i++)
console.log("exp of " + i + " " + Math.exp(i))
console.log("exited worker")
process.exit(0)
}
```
Comments: The BP might be unnecessary, but I had it so I figured I would mention

Viewing all articles
Browse latest Browse all 4630

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>