Avoid destroying shell everytime an exception is raised in waitFor in winRM client
gionn opened this issue · comments
From waitFor() in CifsWinRmConnection.java
try {
outputReaderThread.join();
} finally {
winRmClient.deleteShell();
closeQuietly(callersStdin);
processTerminated = true;
}
After having added support for socket timeout in #156, I've discovered that even for such I/O errors, the shell destroy command is always used, and may be not needed only for an I/O error while reading from a socket, for later reattaching with a new waitFor() on the same Process instance.
I think that the deleteShell() call should probably be removed from the finally clause, and maybe setup a couple of catch clauses to handle specific I/O errors, and deleteShell() for other cases (which ones?).
Suggestions?
Thanks!