@@ -14,6 +14,7 @@ use core::cmp;
14
14
use core:: os;
15
15
use core:: result;
16
16
use core:: run;
17
+ use core:: run:: ProgramOutput ;
17
18
use core:: vec;
18
19
use core:: result:: Result ;
19
20
use std:: getopts;
@@ -104,29 +105,18 @@ pub fn default_config(input_crate: &Path) -> Config {
104
105
}
105
106
}
106
107
107
- struct ProcOut {
108
- status : int,
109
- out : ~str,
110
- err : ~str
111
- }
112
-
113
- type ProgramOutput = fn ~( ( & str) , ( & [ ~str] ) ) -> ProcOut ;
108
+ type Process = fn ~( ( & str) , ( & [ ~str] ) ) -> ProgramOutput ;
114
109
115
- pub fn mock_program_output( _prog: & str, _args: & [ ~str] ) -> ProcOut {
116
- ProcOut {
110
+ pub fn mock_program_output( _prog: & str, _args: & [ ~str] ) -> ProgramOutput {
111
+ ProgramOutput {
117
112
status : 0 ,
118
113
out: ~"",
119
114
err: ~""
120
115
}
121
116
}
122
117
123
- pub fn program_output( prog: & str, args: & [ ~str] ) -> ProcOut {
124
- let { status, out, err} = run:: program_output( prog, args) ;
125
- ProcOut {
126
- status : status,
127
- out : out,
128
- err : err
129
- }
118
+ pub fn program_output( prog: & str, args: & [ ~str] ) -> ProgramOutput {
119
+ run : : program_output( prog, args)
130
120
}
131
121
132
122
pub fn parse_config( args: & [ ~str] ) -> Result < Config , ~str > {
@@ -135,7 +125,7 @@ pub fn parse_config(args: &[~str]) -> Result<Config, ~str> {
135
125
136
126
pub fn parse_config_(
137
127
args: & [ ~str] ,
138
- program_output: ProgramOutput
128
+ program_output: Process
139
129
) -> Result < Config , ~str > {
140
130
let args = args. tail( ) ;
141
131
let opts = vec:: unzip( opts( ) ) . first( ) ;
@@ -159,7 +149,7 @@ pub fn parse_config_(
159
149
fn config_from_opts(
160
150
input_crate: & Path ,
161
151
matches: & getopts:: Matches ,
162
- program_output: ProgramOutput
152
+ program_output: Process
163
153
) -> Result < Config , ~str > {
164
154
165
155
let config = default_config( input_crate) ;
@@ -235,7 +225,7 @@ fn parse_output_style(output_style: &str) -> Result<OutputStyle, ~str> {
235
225
fn maybe_find_pandoc(
236
226
config: & Config ,
237
227
maybe_pandoc_cmd: Option < ~str > ,
238
- program_output: ProgramOutput
228
+ program_output: Process
239
229
) -> Result < Option < ~str > , ~str > {
240
230
if config. output_format != PandocHtml {
241
231
return result:: Ok ( maybe_pandoc_cmd) ;
@@ -272,8 +262,9 @@ fn should_find_pandoc() {
272
262
output_format : PandocHtml ,
273
263
.. default_config( & Path ( "test" ) )
274
264
} ;
275
- let mock_program_output = fn ~( _prog: & str, _args: & [ ~str] ) -> ProcOut {
276
- ProcOut {
265
+ let mock_program_output = fn ~( _prog: & str, _args: & [ ~str] )
266
+ -> ProgramOutput {
267
+ ProgramOutput {
277
268
status : 0 , out : ~"pandoc 1.8 . 2.1 ", err: ~""
278
269
}
279
270
} ;
@@ -287,8 +278,9 @@ fn should_error_with_no_pandoc() {
287
278
output_format : PandocHtml ,
288
279
.. default_config( & Path ( "test" ) )
289
280
} ;
290
- let mock_program_output = fn ~( _prog: & str, _args: & [ ~str] ) -> ProcOut {
291
- ProcOut {
281
+ let mock_program_output = fn ~( _prog: & str, _args: & [ ~str] )
282
+ -> ProgramOutput {
283
+ ProgramOutput {
292
284
status : 1 , out: ~"", err: ~""
293
285
}
294
286
} ;
0 commit comments