mirror of
https://github.com/uutils/coreutils.git
synced 2026-06-10 15:48:22 -07:00
Fix mktemp -t -p ~/projects/playground foo.XXXX
This commit is contained in:
@@ -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));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user