@@ -12,7 +12,7 @@ use core::prelude::*;
1212
1313use  core:: cell:: Cell ; 
1414use  core:: run; 
15- use  core:: run:: ProgramOutput ; 
15+ use  core:: run:: ProcessOutput ; 
1616use  core:: result:: Result ; 
1717use  extra:: getopts; 
1818
@@ -89,35 +89,35 @@ pub fn default_config(input_crate: &Path) -> Config {
8989    } 
9090} 
9191
92- type  Process  = ~fn ( ( & str) ,  ( & [ ~str] ) )  -> ProgramOutput ; 
92+ type  Process  = ~fn ( ( & str) ,  ( & [ ~str] ) )  -> ProcessOutput ; 
9393
94- pub  fn  mock_program_output ( _prog:  & str,  _args:  & [ ~str] )  -> ProgramOutput  { 
95-     ProgramOutput  { 
94+ pub  fn  mock_process_output ( _prog:  & str,  _args:  & [ ~str] )  -> ProcessOutput  { 
95+     ProcessOutput  { 
9696        status :  0 , 
97-         out :  ~"" , 
98-         err :  ~"" 
97+         output :  ~[ ] , 
98+         error :  ~[ ] 
9999    } 
100100} 
101101
102- pub  fn  program_output ( prog:  & str,  args:  & [ ~str] )  -> ProgramOutput  { 
103-     run : : program_output ( prog,  args) 
102+ pub  fn  process_output ( prog:  & str,  args:  & [ ~str] )  -> ProcessOutput  { 
103+     run : : process_output ( prog,  args) 
104104} 
105105
106106pub fn  parse_config( args:  & [ ~str] )  -> Result < Config ,  ~str >  { 
107-     parse_config_( args,  program_output ) 
107+     parse_config_( args,  process_output ) 
108108} 
109109
110110pub  fn  parse_config_( 
111111    args:  & [ ~str] , 
112-     program_output :  Process 
112+     process_output :  Process 
113113)  -> Result < Config ,  ~str >  { 
114114    let  args = args. tail( ) ; 
115115    let  opts = vec:: unzip( opts( ) ) . first( ) ; 
116116    match  getopts:: getopts( args,  opts)  { 
117117        Ok ( matches)  => { 
118118            if  matches. free. len( )  == 1  { 
119119                let  input_crate = Path ( * matches. free. head( ) ) ; 
120-                 config_from_opts( & input_crate,  & matches,  program_output ) 
120+                 config_from_opts( & input_crate,  & matches,  process_output ) 
121121            }  else  if  matches. free. is_empty( )  { 
122122                Err ( ~"no crates specified") 
123123            }  else  { 
@@ -133,7 +133,7 @@ pub fn parse_config_(
133133fn  config_from_opts( 
134134    input_crate:  & Path , 
135135    matches:  & getopts:: Matches , 
136-     program_output :  Process 
136+     process_output :  Process 
137137)  -> Result < Config ,  ~str >  { 
138138
139139    let  config = default_config( input_crate) ; 
@@ -175,11 +175,11 @@ fn config_from_opts(
175175            } 
176176        } 
177177    } ; 
178-     let  program_output  = Cell ( program_output ) ; 
178+     let  process_output  = Cell ( process_output ) ; 
179179    let  result = do result:: chain( result)  |config| { 
180180        let  pandoc_cmd = getopts:: opt_maybe_str( matches,  opt_pandoc_cmd( ) ) ; 
181181        let  pandoc_cmd = maybe_find_pandoc( 
182-             & config,  pandoc_cmd,  program_output . take( ) ) ; 
182+             & config,  pandoc_cmd,  process_output . take( ) ) ; 
183183        do result:: chain( pandoc_cmd)  |pandoc_cmd| { 
184184            result:: Ok ( Config  { 
185185                pandoc_cmd :  pandoc_cmd, 
@@ -209,7 +209,7 @@ fn parse_output_style(output_style: &str) -> Result<OutputStyle, ~str> {
209209pub  fn  maybe_find_pandoc( 
210210    config:  & Config , 
211211    maybe_pandoc_cmd:  Option < ~str > , 
212-     program_output :  Process 
212+     process_output :  Process 
213213)  -> Result < Option < ~str > ,  ~str >  { 
214214    if  config. output_format != PandocHtml  { 
215215        return result:: Ok ( maybe_pandoc_cmd) ; 
@@ -228,7 +228,7 @@ pub fn maybe_find_pandoc(
228228    } ; 
229229
230230    let  pandoc = do vec:: find( possible_pandocs)  |pandoc| { 
231-         let  output = program_output ( * pandoc,  [ ~"--version"] ) ; 
231+         let  output = process_output ( * pandoc,  [ ~"--version"] ) ; 
232232        debug ! ( "testing pandoc cmd %s: %?" ,  * pandoc,  output) ; 
233233        output. status == 0 
234234    } ; 
@@ -244,10 +244,10 @@ pub fn maybe_find_pandoc(
244244mod test  { 
245245    use core:: prelude : : * ; 
246246    use  config:: * ; 
247-     use  core:: run:: ProgramOutput ; 
247+     use  core:: run:: ProcessOutput ; 
248248
249249    fn  parse_config( args:  & [ ~str] )  -> Result < Config ,  ~str >  { 
250-         parse_config_( args,  mock_program_output ) 
250+         parse_config_( args,  mock_process_output ) 
251251    } 
252252
253253    #[ test] 
@@ -256,10 +256,10 @@ mod test {
256256            output_format :  PandocHtml , 
257257            .. default_config( & Path ( "test" ) ) 
258258        } ; 
259-         let  mock_program_output :  ~fn ( & str,  & [ ~str] )  -> ProgramOutput  = |_,  _| { 
260-             ProgramOutput  {  status :  0 ,  out :  ~ "pandoc 1.8 . 2.1 ",  err :  ~""  } 
259+         let  mock_process_output :  ~fn ( & str,  & [ ~str] )  -> ProcessOutput  = |_,  _| { 
260+             ProcessOutput  {  status :  0 ,  output :   "pandoc 1.8.2.1" . to_bytes ( ) ,   error :  ~[ ]  } 
261261        } ; 
262-         let  result = maybe_find_pandoc( & config,  None ,  mock_program_output ) ; 
262+         let  result = maybe_find_pandoc( & config,  None ,  mock_process_output ) ; 
263263        assert!( result == result:: Ok ( Some ( ~"pandoc"))); 
264264    } 
265265
@@ -269,10 +269,10 @@ mod test {
269269            output_format: PandocHtml, 
270270            .. default_config(&Path(" test")) 
271271        }; 
272-         let mock_program_output : ~fn(&str, &[~str]) -> ProgramOutput  = |_, _| { 
273-             ProgramOutput  { status: 1, out : ~"  ", err : ~" "  }
272+         let mock_process_output : ~fn(&str, &[~str]) -> ProcessOutput  = |_, _| { 
273+             ProcessOutput  { status: 1, output : ~[], error : ~[]  } 
274274        }; 
275-         let result = maybe_find_pandoc(&config, None, mock_program_output ); 
275+         let result = maybe_find_pandoc(&config, None, mock_process_output ); 
276276        assert!(result == result::Err(~" couldn' t find pandoc")); 
277277    } 
278278
0 commit comments