Repository: cantino/mcfly (language: rust)

Issue:
mktemp (from coreutils) using relative directory instead of temp directory
I'm using `mktemp` (0.0.15) from https://github.com/uutils/coreutils

Using `mktemp -t mcfly.XXXXXXXX` creates the file in the local directory instead of the temp directory.

If I use `mktemp -p mcfly.XXXXXXXX` it properly places the files in `$TMPDIR`.

This is likely an edge case. I'm not sure if you want to try to fix and if so, how to.


Discussion / hints:
Huh, my version says:

```
     -t prefix
             Generate a template (using the supplied prefix and TMPDIR if set) to create a filename
             template.
```

Maybe something like this would be better?

```MCFLY_HISTORY=$(mktemp ${TMPDIR:/tmp}/mcfly.XXXXXX)```

Fix patch:
diff --git a/mcfly.bash b/mcfly.bash
index 0498ec62..27e946d9 100644
--- a/mcfly.bash
+++ b/mcfly.bash
@@ -35,7 +35,7 @@ if [[ -t 0 ]] && [[ "$__MCFLY_LOADED" != "loaded" ]]; then
 
     # Populate McFly's temporary, per-session history file from recent commands in the shell's primary HISTFILE.
     if [[ ! -f "${MCFLY_HISTORY}" ]]; then
-      MCFLY_HISTORY=$(mktemp -t mcfly.XXXXXXXX)
+      MCFLY_HISTORY=$(mktemp ${TMPDIR:/tmp}/mcfly.XXXXXXXX)
       export MCFLY_HISTORY
       command tail -n100 "${HISTFILE}" >| "${MCFLY_HISTORY}"
     fi
diff --git a/mcfly.fish b/mcfly.fish
index bbc51a62..31f4feb6 100644
--- a/mcfly.fish
+++ b/mcfly.fish
@@ -43,7 +43,7 @@ if test "$__MCFLY_LOADED" != "loaded"
   # If this is an interactive shell, set up key binding functions.
   if status is-interactive
     function __mcfly-history-widget -d "Search command history with McFly"
-      set -l mcfly_output (mktemp -t mcfly.output.XXXXXXXX)
+      set -l mcfly_output (mktemp ${TMPDIR:/tmp}/mcfly.output.XXXXXXXX)
       eval $__MCFLY_CMD search -o '$mcfly_output' -- (commandline | string escape)
 
       # Interpret commandline/run requests from McFly
diff --git a/mcfly.zsh b/mcfly.zsh
index c5f13d85..6751ed74 100644
--- a/mcfly.zsh
+++ b/mcfly.zsh
@@ -27,7 +27,7 @@ if [[ -o interactive ]] && [[ "$__MCFLY_LOADED" != "loaded" ]]; then
 
   # McFly's temporary, per-session history file.
   if [[ ! -f "${MCFLY_HISTORY}" ]]; then
-    export MCFLY_HISTORY=$(command mktemp -t mcfly.XXXXXXXX)
+    export MCFLY_HISTORY=$(command mktemp ${TMPDIR:/tmp}/mcfly.XXXXXXXX)
   fi
 
   # Check if we need to use extended history
@@ -43,7 +43,7 @@ if [[ -o interactive ]] && [[ "$__MCFLY_LOADED" != "loaded" ]]; then
 
     # Populate McFly's temporary, per-session history file from recent commands in the shell's primary HISTFILE.
     if [[ ! -f "${MCFLY_HISTORY}" ]]; then
-      export MCFLY_HISTORY=$(command mktemp -t mcfly.XXXXXXXX)
+      export MCFLY_HISTORY=$(command mktemp ${TMPDIR:/tmp}/mcfly.XXXXXXXX)
       command tail -n100 "${HISTFILE}" >| ${MCFLY_HISTORY}
     fi
 
@@ -70,7 +70,7 @@ if [[ -o interactive ]] && [[ "$__MCFLY_LOADED" != "loaded" ]]; then
       () {
         echoti rmkx
         exec </dev/tty
-        local mcfly_output=$(mktemp -t mcfly.output.XXXXXXXX)
+        local mcfly_output=$(mktemp ${TMPDIR:/tmp}/mcfly.output.XXXXXXXX)
         $MCFLY_PATH --history_format $MCFLY_HISTORY_FORMAT search -o "${mcfly_output}" "${LBUFFER}"
         echoti smkx
 


Test patch: