From 25c532881e3927835c02e41ae5b835a7c0d586f8 Mon Sep 17 00:00:00 2001 From: 2Shirt <2xShirt@gmail.com> Date: Thu, 23 Jan 2020 18:56:11 -0700 Subject: [PATCH] Allow custom temp file suffixes --- scripts/wk/os/linux.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/scripts/wk/os/linux.py b/scripts/wk/os/linux.py index 3a8c346d..060279d1 100644 --- a/scripts/wk/os/linux.py +++ b/scripts/wk/os/linux.py @@ -56,9 +56,12 @@ def get_user_name(): return user -def make_temp_file(): +def make_temp_file(suffix=None): """Make temporary file, returns pathlib.Path() obj.""" - proc = run_program(['mktemp'], check=False) + cmd = ['mktemp'] + if suffix: + cmd.append(f'--suffix={suffix}') + proc = run_program(cmd) return pathlib.Path(proc.stdout.strip())