@@ -177,7 +177,8 @@ def fname_presuffix(fname, prefix='', suffix='', newpath=None, use_ext=True):
177177 '/tmp/prefoopost.nii.gz'
178178
179179 >>> from nipype.interfaces.base import Undefined
180- >>> fname_presuffix(fname, 'pre', 'post', Undefined) == fname_presuffix(fname, 'pre', 'post')
180+ >>> fname_presuffix(fname, 'pre', 'post', Undefined) == \
181+ fname_presuffix(fname, 'pre', 'post')
181182 True
182183
183184 """
@@ -281,15 +282,25 @@ def _parse_mount_table(exit_code, output):
281282 # <PATH>^^^^ ^^^^^<FSTYPE>
282283 # OSX mount example: /dev/disk2 on / (hfs, local, journaled)
283284 # <PATH>^ ^^^<FSTYPE>
284- pattern = re .compile (r'.*? on (/.*?) (?:type |\()([^\s,]+)(?:, |\)| )' )
285+ pattern = re .compile (r'.*? on (/.*?) (?:type |\()([^\s,\)]+)' )
286+
287+ # Keep line and match for error reporting (match == None on failure)
288+ # Ignore empty lines
289+ matches = [(l , pattern .match (l ))
290+ for l in output .strip ().splitlines () if l ]
285291
286292 # (path, fstype) tuples, sorted by path length (longest first)
287- mount_info = sorted ((pattern . match ( l ) .groups ()
288- for l in output . splitlines () ),
293+ mount_info = sorted ((match .groups () for _ , match in matches
294+ if match is not None ),
289295 key = lambda x : len (x [0 ]), reverse = True )
290296 cifs_paths = [path for path , fstype in mount_info
291297 if fstype .lower () == 'cifs' ]
292298
299+ # Report failures as warnings
300+ for line , match in matches :
301+ if match is None :
302+ fmlogger .debug ("Cannot parse mount line: '%s'" , line )
303+
293304 return [
294305 mount for mount in mount_info
295306 if any (mount [0 ].startswith (path ) for path in cifs_paths )
0 commit comments