mirror of
https://github.com/sharkdp/hyperfine.git
synced 2024-09-11 22:17:46 +03:00
Prevent creation of file named '-'
This commit is contained in:
parent
f418a592ac
commit
7f9fde2c50
@ -79,9 +79,6 @@ impl ExportManager {
|
||||
|
||||
/// Add an additional exporter to the ExportManager
|
||||
pub fn add_exporter(&mut self, export_type: ExportType, filename: &str) -> Result<()> {
|
||||
let _ = File::create(filename)
|
||||
.with_context(|| format!("Could not create export file '{}'", filename))?;
|
||||
|
||||
let exporter: Box<dyn Exporter> = match export_type {
|
||||
ExportType::Asciidoc => Box::new(AsciidocExporter::default()),
|
||||
ExportType::Csv => Box::new(CsvExporter::default()),
|
||||
@ -99,6 +96,8 @@ impl ExportManager {
|
||||
"/dev/stdout".to_string()
|
||||
}
|
||||
} else {
|
||||
let _ = File::create(filename)
|
||||
.with_context(|| format!("Could not create export file '{}'", filename))?;
|
||||
filename.to_string()
|
||||
},
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user