Skip to content

Commit

Permalink
gitk: Catch mkdtemp errors
Browse files Browse the repository at this point in the history
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 <gitster@pobox.com>
Helped-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
  • Loading branch information
David Aguilar authored and Paul Mackerras committed Jun 27, 2014
1 parent 105b5d3 commit ac54a4b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion gitk
Original file line number Diff line number Diff line change
Expand Up @@ -3504,7 +3504,9 @@ proc gitknewtmpdir {} {
set tmpdir $gitdir
}
set gitktmpformat [file join $tmpdir ".gitk-tmp.XXXXXX"]
set gitktmpdir [exec mktemp -d $gitktmpformat]
if {[catch {set gitktmpdir [exec mktemp -d $gitktmpformat]}]} {
set gitktmpdir [file join $gitdir [format ".gitk-tmp.%s" [pid]]]
}
if {[catch {file mkdir $gitktmpdir} err]} {
error_popup "[mc "Error creating temporary directory %s:" $gitktmpdir] $err"
unset gitktmpdir
Expand Down

0 comments on commit ac54a4b

Please sign in to comment.