From ac54a4b7715543a29cf72a49a3dd8add32796e86 Mon Sep 17 00:00:00 2001 From: David Aguilar Date: Wed, 18 Jun 2014 19:53:14 -0700 Subject: [PATCH] gitk: Catch mkdtemp errors 105b5d3f ("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 Helped-by: brian m. carlson Signed-off-by: David Aguilar Signed-off-by: Paul Mackerras --- gitk | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gitk b/gitk index 41e5071c4b..9237830328 100755 --- a/gitk +++ b/gitk @@ -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 -- 2.47.1