Skip to content

Commit 19358b3

Browse files
committed
moved delete for tracking even on failure in shutdown of ProcessProxy
1 parent 141e0db commit 19358b3

File tree

1 file changed

+16
-15
lines changed

1 file changed

+16
-15
lines changed

statefulProcessCommandProxy.js

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -181,25 +181,26 @@ function StatefulProcessCommandProxy(config) {
181181
try {
182182
processProxy.shutdown(config.preDestroyCommands)
183183

184-
.then(function(cmdResults) {
184+
.then(function(cmdResults) {
185+
186+
if (cmdResults) {
187+
for (var i=0; i<cmdResults.length; i++) {
188+
var cmdResult = cmdResults[i];
189+
self._log('info',"process preDestroyCmd[" +
190+
cmdResult.command + "] out:" + cmdResult.stdout +
191+
" err:" + cmdResult.stderr);
192+
}
193+
}
185194

186-
// remove from our tracking...
187-
delete self._pid2processMap[processProxy.getPid()];
195+
}).catch(function(error) {
196+
self._log('error',"process destroy, error " +
197+
"while shutting down ProcessProxy["+processProxy.getPid()+"]: " + error);
188198

189-
if (cmdResults) {
190-
for (var i=0; i<cmdResults.length; i++) {
191-
var cmdResult = cmdResults[i];
192-
self._log('info',"process preDestroyCmd[" +
193-
cmdResult.command + "] out:" + cmdResult.stdout +
194-
" err:" + cmdResult.stderr);
195-
}
196-
}
199+
});
197200

198-
}).catch(function(error) {
199-
self._log('error',"process destroy, error " +
200-
"while shutting down ProcessProxy["+processProxy.getPid()+"]: " + error);
201201

202-
});
202+
// remove from our tracking...
203+
delete self._pid2processMap[processProxy.getPid()];
203204

204205
} catch (e) {
205206
self._log('error',"process destroy: preDestroyCommands[" +

0 commit comments

Comments
 (0)