1 |
Author: zmedico |
2 |
Date: 2009-09-27 21:07:38 +0000 (Sun, 27 Sep 2009) |
3 |
New Revision: 14453 |
4 |
|
5 |
Modified: |
6 |
main/trunk/pym/portage/__init__.py |
7 |
Log: |
8 |
Try to avoid blocking on Darwin in _test_pty_eof() by using slave_fd directly |
9 |
instead of fdopen. |
10 |
|
11 |
|
12 |
Modified: main/trunk/pym/portage/__init__.py |
13 |
=================================================================== |
14 |
--- main/trunk/pym/portage/__init__.py 2009-09-27 21:01:49 UTC (rev 14452) |
15 |
+++ main/trunk/pym/portage/__init__.py 2009-09-27 21:07:38 UTC (rev 14453) |
16 |
@@ -3754,9 +3754,6 @@ |
17 |
# may raise EnvironmentError |
18 |
master_fd, slave_fd = pty.openpty() |
19 |
|
20 |
- master_file = os.fdopen(master_fd, 'rb') |
21 |
- slave_file = os.fdopen(slave_fd, 'wb') |
22 |
- |
23 |
# Non-blocking mode is required for Darwin kernel. |
24 |
fcntl.fcntl(master_fd, fcntl.F_SETFL, |
25 |
fcntl.fcntl(master_fd, fcntl.F_GETFL) | os.O_NONBLOCK) |
26 |
@@ -3769,17 +3766,18 @@ |
27 |
|
28 |
# Simulate a subprocess writing some data to the |
29 |
# slave end of the pipe, and then exiting. Do a |
30 |
- # real fork here since otherwise slave_file.close() |
31 |
+ # real fork here since otherwise os.close(slave_fd) |
32 |
# would block on some platforms such as Darwin. |
33 |
pid = os.fork() |
34 |
if pid == 0: |
35 |
- slave_file.write(_unicode_encode(test_string, |
36 |
+ os.write(slave_fd, _unicode_encode(test_string, |
37 |
encoding='utf_8', errors='strict')) |
38 |
- slave_file.close() |
39 |
+ os.close(slave_fd) |
40 |
os._exit(os.EX_OK) |
41 |
else: |
42 |
- slave_file.close() |
43 |
+ os.close(slave_fd) |
44 |
|
45 |
+ master_file = os.fdopen(master_fd, 'rb') |
46 |
eof = False |
47 |
data = [] |
48 |
iwtd = [master_file] |