Skip to content

Commit ac54a4b

Browse files
davvidpaulusmack
authored andcommitted
gitk: Catch mkdtemp errors
105b5d3 ("gitk: Use mktemp -d to avoid predictable temporary directories") introduced a dependency on mkdtemp, which is not available on Windows. Use the original temporary directory behavior when mkdtemp fails. This makes the code use mkdtemp when available and gracefully fallback to the existing behavior when it is not available. Helped-by: Junio C Hamano <[email protected]> Helped-by: brian m. carlson <[email protected]> Signed-off-by: David Aguilar <[email protected]> Signed-off-by: Paul Mackerras <[email protected]>
1 parent 105b5d3 commit ac54a4b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

gitk

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3504,7 +3504,9 @@ proc gitknewtmpdir {} {
35043504
set tmpdir $gitdir
35053505
}
35063506
set gitktmpformat [file join $tmpdir ".gitk-tmp.XXXXXX"]
3507-
set gitktmpdir [exec mktemp -d $gitktmpformat]
3507+
if {[catch {set gitktmpdir [exec mktemp -d $gitktmpformat]}]} {
3508+
set gitktmpdir [file join $gitdir [format ".gitk-tmp.%s" [pid]]]
3509+
}
35083510
if {[catch {file mkdir $gitktmpdir} err]} {
35093511
error_popup "[mc "Error creating temporary directory %s:" $gitktmpdir] $err"
35103512
unset gitktmpdir

0 commit comments

Comments
 (0)