emacs-pager
emacs-pager copied to clipboard
emacs-pager: replace insecure Ruby script with sh version
Use mktemp to create a unique and secure temporary file; avoid clobbering an existing file if the same command is run in parallel sessions, and avoid creating a temporary file with insecure permissions and/or a predictable name.
Also, use shell traps to clean up properly even if interrupted.
I also did something similar tonight at PR https://github.com/mbriggs/emacs-pager/pull/6, but used Python and "with tempfile as f ...". The shell version only traps a subset of all possible signals, but the Python "with .. as f" means that any signal causes the temp file to go out of scope and get deleted: