mirror of
https://github.com/uutils/coreutils
synced 2024-12-14 07:12: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())
|
||||
}
|
||||
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
|
||||
Some(env::temp_dir().display().to_string())
|
||||
} else {
|
||||
|
|
|
@ -872,3 +872,19 @@ fn test_default_issue_4821_t_tmpdir() {
|
|||
println!("stdout = {stdout}");
|
||||
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…
Reference in a new issue