Skip to content
Browse files

recognize warnings

  • Loading branch information...
1 parent 4580f20 commit 46673dffa1dc011660ba72267496c17862fc8b93 @JPMoresmau committed Jan 4, 2013
View
21 ...sf.eclipsefp.haskell.core/src/net/sf/eclipsefp/haskell/core/cabal/CabalPackageHelper.java
@@ -154,23 +154,28 @@ private CabalPackageRef parseRef(final String line){
return null;
}
+ /**
+ * run the command and log any errors, returning a reader to the output
+ * @param opts
+ * @return
+ * @throws IOException
+ */
private BufferedReader run(final String... opts) throws IOException{
ProcessRunner pr=new ProcessRunner();
StringWriter swOut=new StringWriter();
StringWriter swErr=new StringWriter();
pr.executeBlocking( new File("."), swOut, swErr, opts ); //$NON-NLS-1$
String err=swErr.toString();
if (err.length()>0){
- HaskellCorePlugin.log( err, IStatus.ERROR );
+ String warn="warning:";//$NON-NLS-1$
+ // clearly, a warning
+ if (err.toLowerCase().startsWith( warn )){
+ HaskellCorePlugin.log( err.substring( warn.length() ).trim(), IStatus.WARNING );
+ } else {
+ HaskellCorePlugin.log( err, IStatus.ERROR );
+ }
}
return new BufferedReader( new StringReader(swOut.toString()) );
- /*ProcessBuilder pb=new ProcessBuilder();
- pb.redirectErrorStream(false);
- pb.command(opts);
-
- Process p=pb.start();
- return new BufferedReader(new InputStreamReader(p.getInputStream(),FileUtil.UTF8)); //$NON-NLS-1$
- */
}

0 comments on commit 46673df

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