I want to connect a computer by the full computer name on Remote Desktop Connection. In nodejs, i create a child process to execute a cmd command.It executed successfully,but after two minutes, it execute again. I use the kill method of child_process module,it doesn't work.
var child_process = require('child_process');
child_process.exec('mstsc /v ' + fullName, function(err, stdout, stderr) {
if(err){
console.log(err);
}
});
child_process.kill();
Can you help me? Thank you very much!
Iv'e experienced the same issue, It took me a while to understand, the problem was the HTTP server and not the 'chileProccess'. The missing link in your question is the fact you run the the executeScript through an HTTP request (probably expressJs since you get the timeout after 2 min).
The problem: since it was not clear.
What was actually happening is that the HTTP request was reached the timeout boundary set by the HTTP server, which in expressJS is 2 min.
After the timeout, since there was no handling and the request did not closed, it was invoked once more, and so on each 2 min.
The solution:
server.setTimeout() is the method that sets the HTTP connection timeout for all connections.
The 2 minutes are default.
Example: