From 4f5500c4cfdfeb078a9ed54a599d7b8db1468d50 Mon Sep 17 00:00:00 2001 From: evekto <36211178+evekto@users.noreply.github.com> Date: Mon, 6 Nov 2023 13:55:04 +0100 Subject: [PATCH] Remove close-handler for powershell child process 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. --- lib/util.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/lib/util.js b/lib/util.js index fb949bb3..c35778a1 100644 --- a/lib/util.js +++ b/lib/util.js @@ -401,9 +401,6 @@ function powerShellStart() { _psChild.on('error', function () { powerShellProceedResults(_psResult + _psError); }); - _psChild.on('close', function () { - _psChild.kill(); - }); } } }