mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 11:37:44 +00:00
Fix mktemp -t -p ~/projects/playground foo.XXXX
This commit is contained in:
parent
35b5fd6a40
commit
cd189b2391
2 changed files with 19 additions and 1 deletions
|
@ -191,7 +191,9 @@ impl Options {
|
||||||
(tmpdir, template.to_string())
|
(tmpdir, template.to_string())
|
||||||
}
|
}
|
||||||
Some(template) => {
|
Some(template) => {
|
||||||
let tmpdir = if matches.get_flag(OPT_T) {
|
let tmpdir = if matches.contains_id(OPT_TMPDIR) {
|
||||||
|
matches.get_one::<String>(OPT_TMPDIR).map(String::from)
|
||||||
|
} else if matches.get_flag(OPT_T) {
|
||||||
// mktemp -t foo.xxx should export in TMPDIR
|
// mktemp -t foo.xxx should export in TMPDIR
|
||||||
Some(env::temp_dir().display().to_string())
|
Some(env::temp_dir().display().to_string())
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -872,3 +872,19 @@ fn test_default_issue_4821_t_tmpdir() {
|
||||||
println!("stdout = {stdout}");
|
println!("stdout = {stdout}");
|
||||||
assert!(stdout.contains(&pathname));
|
assert!(stdout.contains(&pathname));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_default_issue_4821_t_tmpdir_p() {
|
||||||
|
let scene = TestScenario::new(util_name!());
|
||||||
|
let pathname = scene.fixtures.as_string();
|
||||||
|
let result = scene
|
||||||
|
.ucmd()
|
||||||
|
.arg("-t")
|
||||||
|
.arg("-p")
|
||||||
|
.arg(&pathname)
|
||||||
|
.arg("foo.XXXX")
|
||||||
|
.succeeds();
|
||||||
|
let stdout = result.stdout_str();
|
||||||
|
println!("stdout = {stdout}");
|
||||||
|
assert!(stdout.contains(&pathname));
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue