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 2525from json import dumps , loads
2626from pathlib import Path
2727import shutil
28+ import os
2829from pkg_resources import resource_filename as _pkgres
2930import re
3031
@@ -627,6 +628,19 @@ def _run_interface(self, runtime):
627628 self ._results ["out_file" ].append (str (out_file ))
628629 self ._results ["compression" ].append (str (dest_file ).endswith (".gz" ))
629630
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+
630644 # Set data and header iff changes need to be made. If these are
631645 # still None when it's time to write, just copy.
632646 new_data , new_header = None , None
You can’t perform that action at this time.
0 commit comments