Skip to content

Commit

Permalink
Remove close-handler for powershell child process
Browse files Browse the repository at this point in the history
2 problems could arise in the close-event handler if powerShellStart() is called after powerShellRelease():

1. the variable _psChild could be null if the close-event was fired after the null assignment but before the spawn() call returns.
(in my tests when powerShellStart is called 1s after powerShellRelease).

2. the signal from the kill()-call could be delivered to the newly created powershell subprocess.
(in my tests when powerShellStart is called directly after powerShellRelease).

In my view, the close handler is not necessary.
  • Loading branch information
evekto authored and Alexander Danzer committed Apr 12, 2024
1 parent b4bc62b commit 8aa1ebe
Showing 1 changed file with 0 additions and 3 deletions.
3 changes: 0 additions & 3 deletions lib/util.js
Expand Up @@ -415,9 +415,6 @@ function powerShellStart() {
_psChild.on('error', function () {
powerShellProceedResults(_psResult + _psError);
});
_psChild.on('close', function () {
_psChild.kill();
});
}
}
}
Expand Down

0 comments on commit 8aa1ebe

Please sign in to comment.