Skip to content

Commit 62c83c6

Browse files
committed
replace os.getlogin() with more precise version using pwd
1 parent 8723e5f commit 62c83c6

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

nipype/pipeline/plugins/sge.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"""
33

44
import os
5+
import pwd
56
import re
67
import subprocess
78
import time
@@ -146,7 +147,7 @@ def _qacct_verified_complete(taskid):
146147
qacct_retries -= 1
147148
try:
148149
proc = subprocess.Popen(
149-
[this_command, '-o', os.getlogin(), '-j', str(taskid)],
150+
[this_command, '-o', pwd.getpwuid(os.getuid())[0], '-j', str(taskid)],
150151
stdout=subprocess.PIPE,
151152
stderr=subprocess.PIPE)
152153
qacct_result, _ = proc.communicate()
@@ -248,7 +249,7 @@ def _run_qstat(self, reason_for_qstat, force_instant=True):
248249
qstat_retries -= 1
249250
try:
250251
proc = subprocess.Popen(
251-
[this_command, '-u', os.getlogin(), '-xml', '-s', 'psrz'],
252+
[this_command, '-u', pwd.getpwuid(os.getuid())[0], '-xml', '-s', 'psrz'],
252253
stdout=subprocess.PIPE,
253254
stderr=subprocess.PIPE)
254255
qstat_xml_result, _ = proc.communicate()

0 commit comments

Comments
 (0)