Allow custom temp file suffixes
This commit is contained in:
parent
1b643f3918
commit
25c532881e
1 changed files with 5 additions and 2 deletions
|
|
@ -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())
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue