Skip to content

Commit fda8fa1

Browse files
authored
Merge pull request #2563 from effigies/fix/crashfile_uid
FIX: Print UID in crashfile if login name is unavailable
2 parents 4272c75 + 65bb2c1 commit fda8fa1

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

nipype/pipeline/plugins/tools.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,10 @@ def report_crash(node, traceback=None, hostname=None):
3838
if not traceback:
3939
traceback = format_exception(*sys.exc_info())
4040
timeofcrash = strftime('%Y%m%d-%H%M%S')
41-
login_name = getpass.getuser()
41+
try:
42+
login_name = getpass.getuser()
43+
except KeyError:
44+
login_name = 'UID{:d}'.format(os.getuid())
4245
crashfile = 'crash-%s-%s-%s-%s' % (timeofcrash, login_name, name,
4346
str(uuid.uuid4()))
4447
crashdir = node.config['execution'].get('crashdump_dir', os.getcwd())

0 commit comments

Comments
 (0)