summary refs log tree commit diff stats
path: root/ranger.py
diff options
context:
space:
mode:
authorJesse Byler <jbyler@coverity.com>2015-06-10 16:20:09 -0700
committerJesse Byler <jbyler@coverity.com>2015-06-10 16:20:09 -0700
commit864e372ce78c6e2c027bf525ea9eae1dfd0ddb0a (patch)
treeef692032bceb190aac988b3f94fbe93e333ad668 /ranger.py
parent1a5c0cb9a5409a6214797273b5398ef0e849cd63 (diff)
downloadranger-864e372ce78c6e2c027bf525ea9eae1dfd0ddb0a.tar.gz
Fix mktemp invocation to work on Mac OS X and Linux
mktemp on Mac OS X (and probably all BSDs) just returns an error when
invoked without any arguments.  The -t option used in this change is
interpreted differently on Mac OS X and Linux, and is deprecated on
Linux, but this invocation works as expected on both.

See discussion at https://unix.stackexchange.com/questions/30091
Another alternative would be to use Python's tempfile module:
https://docs.python.org/2/library/tempfile.html
Diffstat (limited to 'ranger.py')
-rwxr-xr-xranger.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/ranger.py b/ranger.py
index 1d7e42e1..864acf27 100755
--- a/ranger.py
+++ b/ranger.py
@@ -9,7 +9,7 @@
 # default is simply "ranger". (Not this file itself!)
 # The other arguments are passed to ranger.
 """":
-tempfile="$(mktemp)"
+tempfile="$(mktemp -t tmp.XXXXXX)"
 ranger="${1:-ranger}"
 test -z "$1" || shift
 "$ranger" --choosedir="$tempfile" "${@:-$(pwd)}"