Skip to content

Commit 1124685

Browse files
sylvestrecakebaker
authored andcommitted
Revert "nohup: Succeed in creating ~/nohup.out for non-UTF8 HOME"
1 parent e6a3bb5 commit 1124685

2 files changed

Lines changed: 2 additions & 22 deletions

File tree

src/uu/nohup/src/nohup.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,12 +150,12 @@ fn find_stdout() -> UResult<File> {
150150
Ok(t)
151151
}
152152
Err(e1) => {
153-
let Some(home) = env::var_os("HOME") else {
153+
let Ok(home) = env::var("HOME") else {
154154
return Err(NohupError::OpenFailed(internal_failure_code, e1).into());
155155
};
156156
let mut homeout = PathBuf::from(home);
157157
homeout.push(NOHUP_OUT);
158-
let homeout_str = homeout.to_string_lossy();
158+
let homeout_str = homeout.to_str().unwrap();
159159
match OpenOptions::new().create(true).append(true).open(&homeout) {
160160
Ok(t) => {
161161
show_error!(

tests/by-util/test_nohup.rs

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -247,23 +247,3 @@ fn test_nohup_stderr_to_stdout() {
247247
assert!(content.contains("stdout message"));
248248
assert!(content.contains("stderr message"));
249249
}
250-
251-
#[test]
252-
#[cfg(all(unix, not(target_os = "macos")))]
253-
fn test_nohup_non_utf8_home() {
254-
use std::{ffi::OsStr, os::unix::ffi::OsStrExt};
255-
let ts = TestScenario::new(util_name!());
256-
let at = &ts.fixtures;
257-
258-
at.mkdir("nohup.out");
259-
at.mkdir(OsStr::from_bytes(b"nohup_home\x80"));
260-
let path = at.plus(OsStr::from_bytes(b"nohup_home\x80"));
261-
262-
ts.ucmd()
263-
.terminal_simulation(true)
264-
.env("HOME", path.as_os_str())
265-
.args(&["true"])
266-
.succeeds();
267-
268-
assert!(at.file_exists(path.join("nohup.out")));
269-
}

0 commit comments

Comments
 (0)