提交 ac54a4b7 编写于 作者: D David Aguilar 提交者: Paul Mackerras

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: NJunio C Hamano <gitster@pobox.com>
Helped-by: Nbrian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: NDavid Aguilar <davvid@gmail.com>
Signed-off-by: NPaul Mackerras <paulus@samba.org>
上级 105b5d3f
......@@ -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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册