mirror of
https://github.com/saltstack/salt.git
synced 2025-04-16 09:40:20 +00:00
Suppress stacktrace with runas with no password
This commit is contained in:
parent
905f8c9826
commit
61890f79af
1 changed files with 6 additions and 1 deletions
|
@ -185,7 +185,12 @@ class HANDLE(wintypes.HANDLE):
|
||||||
|
|
||||||
def Close(self, CloseHandle=kernel32.CloseHandle):
|
def Close(self, CloseHandle=kernel32.CloseHandle):
|
||||||
if self and not getattr(self, "closed", False):
|
if self and not getattr(self, "closed", False):
|
||||||
CloseHandle(self.Detach())
|
try:
|
||||||
|
CloseHandle(self.Detach())
|
||||||
|
except Exception:
|
||||||
|
# Suppress the error when there is no handle (WinError 6)
|
||||||
|
if ctypes.get_last_error() == 6:
|
||||||
|
pass
|
||||||
|
|
||||||
__del__ = Close
|
__del__ = Close
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue