Browse Source

react on 1 exit status

Namdak Tonpa 7 years ago
parent
commit
ea31e9b3fc
1 changed files with 5 additions and 3 deletions
  1. 5 3
      src/compile/mad_cubical.erl

+ 5 - 3
src/compile/mad_cubical.erl

@@ -3,7 +3,9 @@
 -compile(export_all).
 
 compile(File,Inc,Bin,Opt,Deps) ->
-    {_,_,Msg} = sh:run("cubical -b " ++ File),
-    case binary:match(Msg,[<<"successfully!">>]) of
+    {X,Res,Msg} = sh:run("cubical -b " ++ File),
+    case Res of
+         1 -> true;
+         0 -> case binary:match(Msg,[<<"successfully!">>]) of
                    nomatch -> io:format("Error: ~p~n",[Msg]), true;
-                   _ -> io:format("OK: ~p.~n",[filename:basename(File)]), false end.
+                   _ -> io:format("OK: ~p.~n",[filename:basename(File)]), false end end.