this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix: improve error message when inferring output name

+12 -3
+12 -3
src/main.rs
··· 108 108 input: &Option<String>, 109 109 extract: bool, 110 110 ) -> Result<String, io::Error> { 111 + let filename = match get_input_filename(input) { 112 + Ok(name) => name, 113 + Err(_) => { 114 + return Err(io::Error::new( 115 + io::ErrorKind::Other, 116 + "error: can't infer output name while using stdin for input", 117 + )) 118 + } 119 + }; 111 120 match extract { 112 - true => Ok(compressor.default_extracted_filename(Path::new(get_input_filename(input)?))), 113 - false => Ok(compressor.default_compressed_filename(Path::new(get_input_filename(input)?))), 121 + true => Ok(compressor.default_extracted_filename(Path::new(filename))), 122 + false => Ok(compressor.default_compressed_filename(Path::new(filename))), 114 123 } 115 124 } 116 125 ··· 135 144 false => CmprssOutput::Pipe(std::io::stdout()), 136 145 true => { 137 146 if args.output.is_none() { 138 - if !std::io::stdin().is_terminal() { 147 + if !std::io::stdin().is_terminal() && args.input.is_some() { 139 148 // Stdin is being used as the input, so use the 'input' file as the output 140 149 CmprssOutput::Path(Path::new(get_input_filename(&args.input)?)) 141 150 } else {