Commit 3a02076d authored by Jondy Zhao's avatar Jondy Zhao

Apply patch so that slapos.cookbook can work both in linux and cygwin

parent e71e8957
...@@ -43,7 +43,8 @@ def _wait_files_creation(file_list): ...@@ -43,7 +43,8 @@ def _wait_files_creation(file_list):
directories[dirname][event.name] = True directories[dirname][event.name] = True
finally: finally:
os.close(fd) if isinstance(fd, int):
os.close(fd)
def execute(args): def execute(args):
"""Portable execution with process replacement""" """Portable execution with process replacement"""
......
...@@ -48,4 +48,5 @@ def subfiles(directory): ...@@ -48,4 +48,5 @@ def subfiles(directory):
subfiles = [file_.name for file_ in inotifyx.get_events(watchfd)] subfiles = [file_.name for file_ in inotifyx.get_events(watchfd)]
finally: finally:
os.close(watchfd) if isinstance(watchfd, int):
os.close(watchfd)
...@@ -57,7 +57,8 @@ class LockFile(object): ...@@ -57,7 +57,8 @@ class LockFile(object):
except IOError: # add_watch failed except IOError: # add_watch failed
pass pass
finally: finally:
os.close(inotify_fd) if isinstance(inotify_fd, int):
os.close(inotify_fd)
self.__enter__() self.__enter__()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment