@@ -31,8 +31,7 @@ use libc;
31
31
use option:: { Option , Some , None } ;
32
32
use result:: { Ok , Err } ;
33
33
use io:: buffered:: LineBufferedWriter ;
34
- use rt:: rtio:: { IoFactory , RtioTTY , RtioFileStream , with_local_io,
35
- CloseAsynchronously } ;
34
+ use rt:: rtio:: { IoFactory , RtioTTY , RtioFileStream , with_local_io, DontClose } ;
36
35
use super :: { Reader , Writer , io_error, IoError , OtherIoError ,
37
36
standard_error, EndOfFile } ;
38
37
@@ -71,18 +70,9 @@ enum StdSource {
71
70
72
71
fn src < T > ( fd : libc:: c_int , readable : bool , f: |StdSource | -> T ) -> T {
73
72
with_local_io ( |io| {
74
- let fd = unsafe { libc:: dup ( fd) } ;
75
73
match io. tty_open ( fd, readable) {
76
74
Ok ( tty) => Some ( f ( TTY ( tty) ) ) ,
77
- Err ( _) => {
78
- // It's not really that desirable if these handles are closed
79
- // synchronously, and because they're squirreled away in a task
80
- // structure the destructors will be run when the task is
81
- // attempted to get destroyed. This means that if we run a
82
- // synchronous destructor we'll attempt to do some scheduling
83
- // operations which will just result in sadness.
84
- Some ( f ( File ( io. fs_from_raw_fd ( fd, CloseAsynchronously ) ) ) )
85
- }
75
+ Err ( _) => Some ( f ( File ( io. fs_from_raw_fd ( fd, DontClose ) ) ) ) ,
86
76
}
87
77
} ) . unwrap ( )
88
78
}
0 commit comments