Skip to content

Commit dffc7d1

Browse files
committed
FIX: Raise IOErrors on mkfs.vfat and fusefat calls
1 parent c46b932 commit dffc7d1

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

nipype/testing/utils.py

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,23 @@ def __init__(self, size_in_mbytes=8, delay=0.5):
5959
mkfs_args = ['mkfs.vfat', vfatfile]
6060
mount_args = ['fusefat', '-o', 'rw+', '-f', vfatfile, self.vfatmount]
6161

62-
subprocess.check_call(args=mkfs_args, stdout=self.dev_null,
63-
stderr=self.dev_null)
64-
self.fusefat = subprocess.Popen(args=mount_args, stdout=self.dev_null,
65-
stderr=self.dev_null)
62+
try:
63+
subprocess.check_call(args=mkfs_args, stdout=self.dev_null,
64+
stderr=self.dev_null)
65+
except subprocess.CalledProcessError:
66+
raise IOError("mkfs.vfat failed")
67+
68+
try:
69+
self.fusefat = subprocess.Popen(args=mount_args,
70+
stdout=self.dev_null,
71+
stderr=self.dev_null)
72+
except OSError:
73+
raise IOError("fusefat is not installed")
74+
6675
time.sleep(self.delay)
6776

6877
if self.fusefat.poll() is not None:
69-
raise IOError("fatfuse terminated too soon")
78+
raise IOError("fusefat terminated too soon")
7079

7180
open(self.canary, 'wb').close()
7281

0 commit comments

Comments
 (0)