equal
deleted
inserted
replaced
91 util.stderr.flush() |
91 util.stderr.flush() |
92 |
92 |
93 nullfd = os.open(os.devnull, os.O_RDWR) |
93 nullfd = os.open(os.devnull, os.O_RDWR) |
94 logfilefd = nullfd |
94 logfilefd = nullfd |
95 if logfile: |
95 if logfile: |
96 logfilefd = os.open(logfile, os.O_RDWR | os.O_CREAT | os.O_APPEND) |
96 logfilefd = os.open(logfile, os.O_RDWR | os.O_CREAT | os.O_APPEND, |
|
97 0o666) |
97 os.dup2(nullfd, 0) |
98 os.dup2(nullfd, 0) |
98 os.dup2(logfilefd, 1) |
99 os.dup2(logfilefd, 1) |
99 os.dup2(logfilefd, 2) |
100 os.dup2(logfilefd, 2) |
100 if nullfd not in (0, 1, 2): |
101 if nullfd not in (0, 1, 2): |
101 os.close(nullfd) |
102 os.close(nullfd) |