@@ -177,7 +177,8 @@ def fname_presuffix(fname, prefix='', suffix='', newpath=None, use_ext=True):
177
177
'/tmp/prefoopost.nii.gz'
178
178
179
179
>>> 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')
181
182
True
182
183
183
184
"""
@@ -281,15 +282,25 @@ def _parse_mount_table(exit_code, output):
281
282
# <PATH>^^^^ ^^^^^<FSTYPE>
282
283
# OSX mount example: /dev/disk2 on / (hfs, local, journaled)
283
284
# <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 ]
285
291
286
292
# (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 ),
289
295
key = lambda x : len (x [0 ]), reverse = True )
290
296
cifs_paths = [path for path , fstype in mount_info
291
297
if fstype .lower () == 'cifs' ]
292
298
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
+
293
304
return [
294
305
mount for mount in mount_info
295
306
if any (mount [0 ].startswith (path ) for path in cifs_paths )
0 commit comments