nohup: Succeed in creating ~/nohup.out for non-UTF8 HOME

This commit is contained in:
aweinstock
2026-03-04 13:04:05 -05:00
parent e4d943bf07
commit 3edbb2d7f5
2 changed files with 22 additions and 2 deletions
+20
View File
@@ -247,3 +247,23 @@ fn test_nohup_stderr_to_stdout() {
assert!(content.contains("stdout message"));
assert!(content.contains("stderr message"));
}
#[test]
#[cfg(all(unix, not(target_os = "macos")))]
fn test_nohup_non_utf8_home() {
use std::{ffi::OsStr, os::unix::ffi::OsStrExt};
let ts = TestScenario::new(util_name!());
let at = &ts.fixtures;
at.mkdir("nohup.out");
at.mkdir(OsStr::from_bytes(b"nohup_home\x80"));
let path = at.plus(OsStr::from_bytes(b"nohup_home\x80"));
ts.ucmd()
.terminal_simulation(true)
.env("HOME", path.as_os_str())
.args(&["true"])
.succeeds();
assert!(at.file_exists(path.join("nohup.out")));
}