Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion nipype/caching/memory.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,14 @@ def __call__(self, **kwargs):
job_name = hasher.hexdigest()
node = Node(interface, name=job_name)
node.base_dir = os.path.join(self.base_dir, dir_name)
out = node.run()

cwd = os.getcwd()
try:
out = node.run()
finally:
# node.run() changes to the node directory - if something goes wrong
# before it cds back you would end up in strange places
os.chdir(cwd)
if self.callback is not None:
self.callback(dir_name, job_name)
return out
Expand Down