Gracefully handle stdin flush failure on BSD
Catches an IOError that is thrown when starting Swift on BSD-based platforms, as the underlying system call to flush returns errno 9 (bad file descriptor), whereas on Linux it succeeds. Change-Id: Ic143d2fe6c3e1e0b39794958b40b0f5efdc17c06
This commit is contained in:
1 changed files with 6 additions and 1 deletions
@@ -685,7 +685,12 @@ def capture_stdio(logger, **kwargs):
with open(os.devnull, 'r+b') as nullfile:
# close stdio (excludes fds open for logging)
for f in stdio_files:
f.flush()
# some platforms throw an error when attempting an stdin flush
try:
f.flush()
except IOError:
pass
try:
os.dup2(nullfile.fileno(), f.fileno())
except OSError:
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.