Commit fd7105da authored by Anael Beutot's avatar Anael Beutot
Browse files

Fix close_fds utils function

Opening stdout/stderr in write mode to prevent exceptions to be raised.
parent 016284dd
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -294,8 +294,8 @@ def close_fds(exclude_fds=None, debug=False):

    if not debug:
        sys.stdin = open(os.devnull)
        sys.stdout = open(os.devnull)
        sys.stderr = open(os.devnull)
        sys.stdout = open(os.devnull, 'w')
        sys.stderr = open(os.devnull, 'w')
        assert sys.stdin.fileno() == 0
        assert sys.stdout.fileno() == 1
        assert sys.stderr.fileno() == 2