Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion Lib/test/test_tempfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ def setUp(self):
def tearDown(self):
self._warnings_manager.__exit__(None, None, None)


def nameCheck(self, name, dir, pre, suf):
(ndir, nbase) = os.path.split(name)
npre = nbase[:len(pre)]
Expand Down Expand Up @@ -184,12 +183,15 @@ def test_process_awareness(self):
try:
pid = os.fork()
if not pid:
# child process
os.close(read_fd)
os.write(write_fd, next(self.r).encode("ascii"))
os.close(write_fd)
# bypass the normal exit handlers- leave those to
# the parent.
os._exit(0)

# parent process
parent_value = next(self.r)
child_value = os.read(read_fd, len(parent_value)).decode("ascii")
finally:
Expand All @@ -200,6 +202,10 @@ def test_process_awareness(self):
os.kill(pid, signal.SIGKILL)
except OSError:
pass

# Read the process exit status to avoid zombie process
os.waitpid(pid, 0)

os.close(read_fd)
os.close(write_fd)
self.assertNotEqual(child_value, parent_value)
Expand Down