1 |
Author: zmedico |
2 |
Date: 2009-09-27 20:12:29 +0000 (Sun, 27 Sep 2009) |
3 |
New Revision: 14451 |
4 |
|
5 |
Modified: |
6 |
main/trunk/pym/portage/__init__.py |
7 |
Log: |
8 |
Make _test_pty_eof() fork when writing to the slave_fd, since otherwise |
9 |
it would block on some platforms such as Darwin. |
10 |
|
11 |
|
12 |
Modified: main/trunk/pym/portage/__init__.py |
13 |
=================================================================== |
14 |
--- main/trunk/pym/portage/__init__.py 2009-09-27 19:47:13 UTC (rev 14450) |
15 |
+++ main/trunk/pym/portage/__init__.py 2009-09-27 20:12:29 UTC (rev 14451) |
16 |
@@ -3768,10 +3768,18 @@ |
17 |
termios.tcsetattr(slave_fd, termios.TCSANOW, mode) |
18 |
|
19 |
# Simulate a subprocess writing some data to the |
20 |
- # slave end of the pipe, and then exiting. |
21 |
- slave_file.write(_unicode_encode(test_string, |
22 |
- encoding='utf_8', errors='strict')) |
23 |
- slave_file.close() |
24 |
+ # slave end of the pipe, and then exiting. Do a |
25 |
+ # real fork here since otherwise slave_file.close() |
26 |
+ # would block on some platforms such as Darwin. |
27 |
+ pid = os.fork() |
28 |
+ if pid == 0: |
29 |
+ slave_file.write(_unicode_encode(test_string, |
30 |
+ encoding='utf_8', errors='strict')) |
31 |
+ slave_file.close() |
32 |
+ os._exit(os.EX_OK) |
33 |
+ else: |
34 |
+ slave_file.close() |
35 |
+ os.waitpid(pid, 0) |
36 |
|
37 |
eof = False |
38 |
data = [] |