coreybutler / coreybutler/node-windows
Elevate Process Exits Immediately
- Dominant language
- JavaScript
- Stars
- 2.9k
- Forks
- 368
- PR merge metrics
- No merged PRs in 30d
Description
Normally, I might do something like this (using calc just for example):
```
require('child_process').exec('calc',
function (error, stdout, stderr) {
console.log('stdout: ' + stdout);
console.log('stderr: ' + stderr);
if (error !== null) {
console.log('exec error: ' + error);
}
});
```
This will open calc, and `stdout` and `stderr` will log after I close it, which allows me to check the output and respond when the user closes the child process. But when I use elevate:
```
require('node-windows').elevate('calc',
function (error, stdout, stderr) {
console.log('stdout: ' + stdout);
console.log('stderr: ' + stderr);
if (error !== null) {
console.log('exec error: ' + error);
}
});
```
Calc does indeed open with elevated privledges, but now `stdout` and `stderr` log immediately, I presume because it's aware of only the cmd or vbs, and not calc itself. This creates a problem, because now I can't check output or respond to the real close event.
I was hoping you had some thoughts to get around this issue.
Contributor guide
Assessment
This issue has not been assessed yet.