Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
nni
Commits
c4d449c5
Unverified
Commit
c4d449c5
authored
Jun 08, 2021
by
liuzhe-lz
Committed by
GitHub
Jun 08, 2021
Browse files
Catch clean up error to prevent crash (#3729)
Co-authored-by:
liuzhe
<
zhe.liu@microsoft.com
>
parent
700026c5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
6 deletions
+15
-6
nni/experiment/pipe.py
nni/experiment/pipe.py
+15
-6
No files found.
nni/experiment/pipe.py
View file @
c4d449c5
from
io
import
BufferedIOBase
from
io
import
BufferedIOBase
import
logging
import
os
import
os
import
sys
import
sys
_logger
=
logging
.
getLogger
(
__name__
)
if
sys
.
platform
==
'win32'
:
if
sys
.
platform
==
'win32'
:
import
_winapi
import
_winapi
import
msvcrt
import
msvcrt
...
@@ -29,8 +32,11 @@ if sys.platform == 'win32':
...
@@ -29,8 +32,11 @@ if sys.platform == 'win32':
return
self
.
file
return
self
.
file
def
close
(
self
)
->
None
:
def
close
(
self
)
->
None
:
if
self
.
file
is
not
None
:
try
:
self
.
file
.
close
()
if
self
.
file
is
not
None
:
self
.
file
.
close
()
except
Exception
as
e
:
_logger
.
debug
(
'Error on closing Windows pipe: %s'
,
e
)
Pipe
=
WindowsPipe
Pipe
=
WindowsPipe
...
@@ -55,9 +61,12 @@ else:
...
@@ -55,9 +61,12 @@ else:
return
self
.
file
return
self
.
file
def
close
(
self
)
->
None
:
def
close
(
self
)
->
None
:
if
self
.
file
is
not
None
:
try
:
self
.
file
.
close
()
if
self
.
file
is
not
None
:
self
.
_socket
.
close
()
self
.
file
.
close
()
os
.
unlink
(
self
.
path
)
self
.
_socket
.
close
()
os
.
unlink
(
self
.
path
)
except
Exception
as
e
:
_logger
.
debug
(
'Error on closing POSIX pipe: %s'
,
e
)
Pipe
=
UnixPipe
Pipe
=
UnixPipe
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment