Skip to content

Commit

Permalink
Create intermediary directories for --output-file (#11550)
Browse files Browse the repository at this point in the history
Closes #11549.
  • Loading branch information
charliermarsh authored May 26, 2024
1 parent 77da461 commit b5d147d
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions crates/ruff/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,9 @@ pub fn check(args: CheckCommand, global_options: GlobalConfigArgs) -> Result<Exi
let mut writer: Box<dyn Write> = match cli.output_file {
Some(path) if !cli.watch => {
colored::control::set_override(false);
if let Some(parent) = path.parent() {
std::fs::create_dir_all(parent)?;
}
let file = File::create(path)?;
Box::new(BufWriter::new(file))
}
Expand Down

0 comments on commit b5d147d

Please sign in to comment.