Skip to content

Commit 49a4091

Browse files
authored
Correctly handle the permissions of temp files on unix (#772)
1 parent 3e43899 commit 49a4091

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
All notable changes to MiniJinja are documented here.
44

5+
## 2.10.0
6+
7+
- Fix incorrect permissions when `--output` is used in the CLI. #772
8+
59
## 2.9.0
610

711
- Do not panic if too large templates (too many lines or too many

minijinja-cli/src/output.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,14 @@ impl Output {
1717
None
1818
} else {
1919
let filename = std::env::current_dir()?.join(filename);
20-
let ntf = NamedTempFile::new_in(
20+
#[allow(unused_mut)]
21+
let mut builder = tempfile::Builder::new();
22+
#[cfg(unix)]
23+
{
24+
use std::os::unix::fs::PermissionsExt;
25+
builder.permissions(std::fs::Permissions::from_mode(0o666));
26+
}
27+
let ntf = builder.tempfile_in(
2128
filename
2229
.parent()
2330
.ok_or_else(|| anyhow!("cannot write to root"))?,

0 commit comments

Comments
 (0)