File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change 25
25
from json import dumps , loads
26
26
from pathlib import Path
27
27
import shutil
28
+ import os
28
29
from pkg_resources import resource_filename as _pkgres
29
30
import re
30
31
@@ -627,6 +628,19 @@ def _run_interface(self, runtime):
627
628
self ._results ["out_file" ].append (str (out_file ))
628
629
self ._results ["compression" ].append (str (dest_file ).endswith (".gz" ))
629
630
631
+ # An odd but possible case is that an input file is in the location of
632
+ # the output and we have made no changes to it.
633
+ # The primary use case is pre-computed derivatives where the output
634
+ # directory will be filled in.
635
+ # From a provenance perspective, I would rather inputs and outputs be
636
+ # cleanly separated, but that is better handled by warnings at the CLI
637
+ # level than a crash in a datasink.
638
+ try :
639
+ if os .path .samefile (orig_file , out_file ):
640
+ continue
641
+ except FileNotFoundError :
642
+ pass
643
+
630
644
# Set data and header iff changes need to be made. If these are
631
645
# still None when it's time to write, just copy.
632
646
new_data , new_header = None , None
You can’t perform that action at this time.
0 commit comments