From cc5d6ffcd62e7ee23b583356754b396b4b670eb0 Mon Sep 17 00:00:00 2001
From: Paul McCarthy <pauldmccarthy@gmail.com>
Date: Thu, 19 Mar 2020 10:56:14 +0000
Subject: [PATCH] RF: runfsl errors on non-FSL commands

---
 fsl/utils/run.py | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/fsl/utils/run.py b/fsl/utils/run.py
index db6af1925..7211965d7 100644
--- a/fsl/utils/run.py
+++ b/fsl/utils/run.py
@@ -3,6 +3,7 @@
 # run.py - Functions for running shell commands
 #
 # Author: Paul McCarthy <pauldmccarthy@gmail.com>
+# Author: Michiel Cottaar <michiel.cottaar@ndcn.ox.ac.uk>
 #
 """This module provides some functions for running shell commands.
 
@@ -358,6 +359,12 @@ def runfsl(*args, **kwargs):
             args[0] = cmdpath
             break
 
+    # error if the command cannot
+    # be found in a FSL directory
+    else:
+        raise FileNotFoundError('FSL tool {} not found (checked {})'.format(
+            args[0], ', '.join(prefixes)))
+
     return run(*args, **kwargs)
 
 
-- 
GitLab