Skip to content

Commit b5d147d

Browse files
Create intermediary directories for --output-file (#11550)
Closes #11549.
1 parent 77da461 commit b5d147d

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

crates/ruff/src/lib.rs

+3
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,9 @@ pub fn check(args: CheckCommand, global_options: GlobalConfigArgs) -> Result<Exi
237237
let mut writer: Box<dyn Write> = match cli.output_file {
238238
Some(path) if !cli.watch => {
239239
colored::control::set_override(false);
240+
if let Some(parent) = path.parent() {
241+
std::fs::create_dir_all(parent)?;
242+
}
240243
let file = File::create(path)?;
241244
Box::new(BufWriter::new(file))
242245
}

0 commit comments

Comments
 (0)