Skip to content

Commit

Permalink
Fixes #21 - use a copy instead of move for temp files
Browse files Browse the repository at this point in the history
  • Loading branch information
jfischer committed Mar 26, 2019
1 parent ce3ca5c commit 78f79e7
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion dataworkspaces/commands/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import os
from os.path import isfile, abspath, expanduser, join, isabs, isdir, dirname, exists
import click
import shutil
from subprocess import run, PIPE
import re
from tempfile import NamedTemporaryFile
Expand Down Expand Up @@ -50,7 +51,9 @@ def write_and_hash_file(write_fn, filename_template, verbose):
if exists(target_name):
return (hashval, target_name, False)
else:
os.rename(tfilename, target_name)
# issue #21 - need to use a copy instead of a rename,
# in case /tmp is on a different filesystem.
shutil.copyfile(tfilename, target_name)
return (hashval, target_name, True)
finally:
if exists(tfilename):
Expand Down

0 comments on commit 78f79e7

Please sign in to comment.