rc: Fix calls to mktemp

The GNU and BSD implementations differ on several points, this commit
hopefully finds a middle ground.
This commit is contained in:
Frank LENORMAND 2017-06-09 14:05:31 +03:00
parent 2992d5bb0b
commit cb9a2e562b
11 changed files with 14 additions and 14 deletions

View File

@ -8,7 +8,7 @@ decl -hidden range-specs lint_errors
def lint -docstring 'Parse the current buffer with a linter' %{
%sh{
dir=$(mktemp --tmpdir -d kak-lint.XXXXXXXX)
dir=$(mktemp -d "${TMPDIR:-/tmp}"/kak-lint.XXXXXXXX)
mkfifo "$dir"/fifo
printf '%s\n' "eval -no-hooks write $dir/buf"

View File

@ -11,7 +11,7 @@ Formats of language supported:
spell %{
try %{ add-highlighter ranges 'spell_regions' }
%sh{
file=$(mktemp --tmpdir -d kak-spell.XXXXXXXX)/buffer
file=$(mktemp -d "${TMPDIR:-/tmp}"/kak-spell.XXXXXXXX)/buffer
printf 'eval -no-hooks write %s\n' "${file}"
printf 'set buffer spell_tmp_file %s\n' "${file}"
}

View File

@ -3,7 +3,7 @@ decl -docstring "name of the client in which documentation is to be displayed" \
def -hidden -params 1..2 doc-open %{
%sh{
manout=$(mktemp --tmpdir kak-man-XXXXXX)
manout=$(mktemp "${TMPDIR:-/tmp}"/kak-man-XXXXXX)
# Those options are handled by the `man-db` implementation
export MANWIDTH=${kak_window_width}

View File

@ -8,7 +8,7 @@ def -params .. -file-completion \
-docstring %{grep [<arguments>]: grep utility wrapper
All the optional arguments are forwarded to the grep utility} \
grep %{ %sh{
output=$(mktemp -d -t kak-grep.XXXXXXXX)/fifo
output=$(mktemp -d "${TMPDIR:-/tmp}"/kak-grep.XXXXXXXX)/fifo
mkfifo ${output}
if [ $# -gt 0 ]; then
( ${kak_opt_grepcmd} "$@" | tr -d '\r' > ${output} 2>&1 ) > /dev/null 2>&1 < /dev/null &

View File

@ -11,7 +11,7 @@ def -params .. \
-docstring %{make [<arguments>]: make utility wrapper
All the optional arguments are forwarded to the make utility} \
make %{ %sh{
output=$(mktemp --tmpdir -d kak-make.XXXXXXXX)/fifo
output=$(mktemp -d "${TMPDIR:-/tmp}"/kak-make.XXXXXXXX)/fifo
mkfifo ${output}
( eval ${kak_opt_makecmd} "$@" > ${output} 2>&1 ) > /dev/null 2>&1 < /dev/null &

View File

@ -28,8 +28,8 @@ hook global WinSetOption filetype=(?!man).* %{
}
def -hidden -params 1..2 man-impl %{ %sh{
manout=$(mktemp --tmpdir kak-man-XXXXXX)
colout=$(mktemp --tmpdir kak-man-XXXXXX)
manout=$(mktemp "${TMPDIR:-/tmp}"/kak-man-XXXXXX)
colout=$(mktemp "${TMPDIR:-/tmp}"/kak-man-XXXXXX)
MANWIDTH=${kak_window_width} man "$@" > $manout
retval=$?
col -b -x > ${colout} < ${manout}

View File

@ -11,7 +11,7 @@ def -params ..1 \
The syntaxic errors detected during parsing are shown when auto-diagnostics are enabled} \
clang-parse %{
%sh{
dir=$(mktemp --tmpdir -d kak-clang.XXXXXXXX)
dir=$(mktemp -d "${TMPDIR:-/tmp}"/kak-clang.XXXXXXXX)
mkfifo ${dir}/fifo
printf %s\\n "set buffer clang_tmp_dir ${dir}"
printf %s\\n "eval -no-hooks write ${dir}/buf"

View File

@ -39,7 +39,7 @@ Available commands:\n-add\n-rm\n-blame\n-commit\n-checkout\n-diff\n-hide-blame\n
log) filetype=git-log ;;
status) filetype=git-status ;;
esac
output=$(mktemp --tmpdir -d kak-git.XXXXXXXX)/fifo
output=$(mktemp -d "${TMPDIR:-/tmp}"/kak-git.XXXXXXXX)/fifo
mkfifo ${output}
( git "$@" > ${output} 2>&1 ) > /dev/null 2>&1 < /dev/null &

View File

@ -13,7 +13,7 @@ decl -hidden completions gocode_completions
def go-complete -docstring "Complete the current selection with gocode" %{
%sh{
dir=$(mktemp --tmpdir -d kak-go.XXXXXXXX)
dir=$(mktemp -d "${TMPDIR:-/tmp}"/kak-go.XXXXXXXX)
printf %s\\n "set buffer go_complete_tmp_dir ${dir}"
printf %s\\n "eval -no-hooks write ${dir}/buf"
}
@ -56,7 +56,7 @@ decl -hidden str go_format_tmp_dir
def -params ..1 go-format \
-docstring "go-format [-use-goimports]: custom formatter for go files" %{
%sh{
dir=$(mktemp --tmpdir -d kak-go.XXXXXXXX)
dir=$(mktemp -d "${TMPDIR:-/tmp}"/kak-go.XXXXXXXX)
printf %s\\n "set buffer go_format_tmp_dir ${dir}"
printf %s\\n "eval -no-hooks write ${dir}/buf"
}
@ -87,7 +87,7 @@ decl -hidden str go_doc_tmp_dir
# FIXME text escaping
def -hidden -params 1..2 gogetdoc-cmd %{
%sh{
dir=$(mktemp --tmpdir -d kak-go.XXXXXXXX)
dir=$(mktemp -d "${TMPDIR:-/tmp}"/kak-go.XXXXXXXX)
printf %s\\n "set buffer go_doc_tmp_dir ${dir}"
printf %s\\n "eval -no-hooks write ${dir}/buf"
}

View File

@ -5,7 +5,7 @@ decl -docstring "colon separated list of path added to `python`'s $PYTHONPATH en
def jedi-complete -docstring "Complete the current selection" %{
%sh{
dir=$(mktemp --tmpdir -d kak-jedi.XXXXXXXX)
dir=$(mktemp -d "${TMPDIR:-/tmp}"/kak-jedi.XXXXXXXX)
mkfifo ${dir}/fifo
printf %s\\n "set buffer jedi_tmp_dir ${dir}"
printf %s\\n "eval -no-hooks write ${dir}/buf"

View File

@ -3,7 +3,7 @@ decl -hidden completions racer_completions
def racer-complete -docstring "Complete the current selection with racer" %{
%sh{
dir=$(mktemp --tmpdir -d kak-racer.XXXXXXXX)
dir=$(mktemp -d "${TMPDIR:-/tmp}"/kak-racer.XXXXXXXX)
printf %s\\n "set buffer racer_tmp_dir ${dir}"
printf %s\\n "eval -no-hooks %{ write ${dir}/buf }"
}