Skip to content
This repository
Browse code

check return code

  • Loading branch information...
commit 773e416f566cde2f57639aa84ec9a02a50eb6ccd 1 parent a4ce338
JP Moresmau authored October 26, 2012
1  docs/releasenotes/net.sf.eclipsefp.haskell_2.3.2.txt
@@ -17,6 +17,7 @@ Fixes:
17 17
 	- synchronize operations do not block other operations
18 18
 	- Terminating a debugging session when stopped at a breakpoint removes correctly breakpoint marker in code
19 19
 	- Terminating a debugging session correctly forbids to resume execution (restart a new session)
  20
+	- Do not try to parse hlint output if the process returned in error
20 21
 
21 22
 Features:
22 23
 	- Specify the cabal stanza you want to use settings from when checking a file in the editor
2  net.sf.eclipsefp.haskell-feature/feature.xml
@@ -151,7 +151,7 @@ available at http://www.eclipse.org/legal/epl-v10.html.
151 151
          id="net.sf.eclipsefp.haskell.hlint"
152 152
          download-size="0"
153 153
          install-size="0"
154  
-         version="2.3.1"
  154
+         version="2.3.2"
155 155
          unpack="false"/>
156 156
 
157 157
    <plugin
2  net.sf.eclipsefp.haskell.hlint/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
2 2
 Bundle-ManifestVersion: 2
3 3
 Bundle-Name: %bundleName
4 4
 Bundle-SymbolicName: net.sf.eclipsefp.haskell.hlint;singleton:=true
5  
-Bundle-Version: 2.3.1
  5
+Bundle-Version: 2.3.2
6 6
 Bundle-Activator: net.sf.eclipsefp.haskell.hlint.HLintPlugin
7 7
 Require-Bundle: org.eclipse.ui;bundle-version="[3.2.0,4.0.0)",
8 8
  org.eclipse.core.runtime;bundle-version="[3.2.0,4.0.0)",
107  net.sf.eclipsefp.haskell.hlint/src/net/sf/eclipsefp/haskell/hlint/HLintRunner.java
... ...
@@ -1,53 +1,54 @@
1  
-/**
2  
- * (c) 2011, Alejandro Serrano
3  
- * Released under the terms of the EPL.
4  
- */
5  
-package net.sf.eclipsefp.haskell.hlint;
6  
-
7  
-import java.io.StringReader;
8  
-import java.io.StringWriter;
9  
-import java.util.ArrayList;
10  
-import java.util.List;
11  
-
12  
-import net.sf.eclipsefp.haskell.hlint.parser.OutputParser;
13  
-import net.sf.eclipsefp.haskell.hlint.util.HLintText;
14  
-import net.sf.eclipsefp.haskell.util.ProcessRunner;
15  
-
16  
-import org.eclipse.core.runtime.IPath;
17  
-import org.eclipse.osgi.util.NLS;
18  
-
19  
-/**
20  
- * Class the encapsulates the logic of calling hlint and
21  
- * sending the output to the parser to generate a list
22  
- * of suggestions.
23  
- * 
24  
- * @author Alejandro Serrano
25  
- * @author JP Moresmau
26  
- * 
27  
- */
28  
-public class HLintRunner {
29  
-	
30  
-	public List<Suggestion> run(IPath path) {
31  
-		StringWriter err=new StringWriter();
32  
-		StringWriter out=new StringWriter();
33  
-		try {
34  
-			String exe=HLintPlugin.getHlintPath();
35  
-			if (exe==null || exe.length()==0){
36  
-				exe="hlint"; // hope it's in the path
37  
-			}
38  
-			new ProcessRunner().executeBlocking(path.toFile().getParentFile(), out, err,  exe, path.toOSString());
39  
-			
40  
-			OutputParser parser = new OutputParser(new StringReader(out.toString()));
41  
-			return parser.suggestions();
42  
-		} catch (Throwable ex) {
43  
-			String msg=err.toString().length()>0?err.toString():out.toString();
44  
-			HLintPlugin.logError(NLS.bind(HLintText.error_run,msg), ex);
45  
-		}
46  
-		return new ArrayList<Suggestion>();
47  
-	}
48  
-	
49  
-	public static List<Suggestion> runHLintOn(IPath path) {
50  
-		HLintRunner runner = new HLintRunner();
51  
-		return runner.run(path);
52  
-	}
53  
-}
  1
+/**
  2
+ * (c) 2011, Alejandro Serrano
  3
+ * Released under the terms of the EPL.
  4
+ */
  5
+package net.sf.eclipsefp.haskell.hlint;
  6
+
  7
+import java.io.StringReader;
  8
+import java.io.StringWriter;
  9
+import java.util.ArrayList;
  10
+import java.util.List;
  11
+
  12
+import net.sf.eclipsefp.haskell.hlint.parser.OutputParser;
  13
+import net.sf.eclipsefp.haskell.hlint.util.HLintText;
  14
+import net.sf.eclipsefp.haskell.util.ProcessRunner;
  15
+
  16
+import org.eclipse.core.runtime.IPath;
  17
+import org.eclipse.osgi.util.NLS;
  18
+
  19
+/**
  20
+ * Class the encapsulates the logic of calling hlint and
  21
+ * sending the output to the parser to generate a list
  22
+ * of suggestions.
  23
+ * 
  24
+ * @author Alejandro Serrano
  25
+ * @author JP Moresmau
  26
+ * 
  27
+ */
  28
+public class HLintRunner {
  29
+	
  30
+	public List<Suggestion> run(IPath path) {
  31
+		StringWriter err=new StringWriter();
  32
+		StringWriter out=new StringWriter();
  33
+		try {
  34
+			String exe=HLintPlugin.getHlintPath();
  35
+			if (exe==null || exe.length()==0){
  36
+				exe="hlint"; // hope it's in the path
  37
+			}
  38
+			int code=new ProcessRunner().executeBlocking(path.toFile().getParentFile(), out, err,  exe, path.toOSString());
  39
+			if (code==0){
  40
+				OutputParser parser = new OutputParser(new StringReader(out.toString()));
  41
+				return parser.suggestions();
  42
+			}
  43
+		} catch (Throwable ex) {
  44
+			String msg=err.toString().length()>0?err.toString():out.toString();
  45
+			HLintPlugin.logError(NLS.bind(HLintText.error_run,msg), ex);
  46
+		}
  47
+		return new ArrayList<Suggestion>();
  48
+	}
  49
+	
  50
+	public static List<Suggestion> runHLintOn(IPath path) {
  51
+		HLintRunner runner = new HLintRunner();
  52
+		return runner.run(path);
  53
+	}
  54
+}

0 notes on commit 773e416

Please sign in to comment.
Something went wrong with that request. Please try again.