From afb0c5000f540797ab4c074fd5a7e2a2fb2e2b70 Mon Sep 17 00:00:00 2001
From: Olivier Langella <Olivier.Langella@moulon.inra.fr>
Date: Thu, 24 Oct 2013 17:23:30 +0200
Subject: [PATCH] check that command file exists and is executable

---
 .../pappso/xtandempipeline/thread/base_shell.java     | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/src/fr/inra/pappso/xtandempipeline/thread/base_shell.java b/src/fr/inra/pappso/xtandempipeline/thread/base_shell.java
index 655bcba2a..35ac9f1e7 100644
--- a/src/fr/inra/pappso/xtandempipeline/thread/base_shell.java
+++ b/src/fr/inra/pappso/xtandempipeline/thread/base_shell.java
@@ -45,6 +45,15 @@ public class base_shell {
 	public void start_process() throws Exception {
 		if (application.equals(""))
 			throw new MSMSException("No application specified");
+		File appFile = new File(application);
+		if (!appFile.exists()) {
+			throw new MSMSException("no command file named : \n"
+					+ appFile.getAbsolutePath());
+		}
+		if (!appFile.canExecute()) {
+			throw new MSMSException("unable to execute command : \n"
+					+ appFile.getAbsolutePath());
+		}
 		build = new ProcessBuilder(commande);
 		build.redirectErrorStream(true);
 		process_run = build.start();
@@ -92,7 +101,7 @@ public class base_shell {
 					while (line != -1) {
 						// processing(line);
 						stdout.append((char) line);
-						//System.out.print((char)line);
+						// System.out.print((char)line);
 						line = reader.read();
 					}
 				} finally {
-- 
GitLab