File tree Expand file tree Collapse file tree 2 files changed +17
-15
lines changed Expand file tree Collapse file tree 2 files changed +17
-15
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,11 @@ import task;
8
8
import core:: result;
9
9
import result :: { ok, err} ;
10
10
11
+ import comm:: port;
12
+ import comm:: chan;
13
+ import comm:: send;
14
+ import comm:: recv;
15
+
11
16
import common:: config;
12
17
import common:: mode_run_pass;
13
18
import common:: mode_run_fail;
Original file line number Diff line number Diff line change @@ -2,8 +2,6 @@ import run::spawn_process;
2
2
import io:: { writer_util, reader_util} ;
3
3
import libc:: { c_int, pid_t} ;
4
4
5
- import pipes:: chan;
6
-
7
5
export run;
8
6
9
7
#[ cfg( target_os = "win32" ) ]
@@ -60,30 +58,29 @@ fn run(lib_path: ~str,
60
58
61
59
62
60
writeclose ( pipe_in. out , input) ;
63
- let p = pipes :: port_set ( ) ;
64
- let ch = p . chan ( ) ;
61
+ let p = comm :: port ( ) ;
62
+ let ch = comm :: chan ( p ) ;
65
63
do task:: spawn_sched ( task:: single_threaded) {
66
64
let errput = readclose ( pipe_err. in ) ;
67
- ch . send ( ( 2 , errput) ) ;
65
+ comm :: send ( ch , ( 2 , errput) ) ;
68
66
}
69
- let ch = p. chan ( ) ;
70
67
do task:: spawn_sched ( task:: single_threaded) {
71
68
let output = readclose ( pipe_out. in ) ;
72
- ch . send ( ( 1 , output) ) ;
69
+ comm :: send ( ch , ( 1 , output) ) ;
73
70
}
74
71
let status = run:: waitpid ( pid) ;
75
72
let mut errs = ~"";
76
73
let mut outs = ~"";
77
74
let mut count = 2 ;
78
75
while count > 0 {
79
- alt p . recv ( ) {
80
- ( 1 , s ) {
81
- outs = s ;
82
- }
83
- ( 2 , s ) {
84
- errs = s ;
85
- }
86
- _ { fail }
76
+ let stream = comm :: recv ( p ) ;
77
+ alt check stream {
78
+ ( 1 , s ) {
79
+ outs = s ;
80
+ }
81
+ ( 2 , s ) {
82
+ errs = s ;
83
+ }
87
84
} ;
88
85
count -= 1 ;
89
86
} ;
You can’t perform that action at this time.
0 commit comments