@@ -138,6 +138,7 @@ public RewriterResult execute(K k, Optional<Integer> depth) {
138138 try {
139139 File korePath = koreDirectory == null ? null : new File (koreDirectory );
140140 int execStatus = executeCommandBasic (korePath , koreCommand );
141+ checkOutput (koreOutputFile , execStatus );
141142 K outputK = new KoreParser (mod .sortAttributesFor ()).parseFile (koreOutputFile );
142143 return new RewriterResult (Optional .empty (), Optional .of (execStatus ), outputK );
143144 } catch (IOException e ) {
@@ -283,6 +284,7 @@ private RewriterResult executeKoreCommands(Module rules, String[] koreCommand,
283284 try {
284285 File korePath = koreDirectory == null ? null : new File (koreDirectory );
285286 exit = executeCommandBasic (korePath , koreCommand );
287+ checkOutput (koreOutputFile , exit );
286288 } catch (IOException e ) {
287289 throw KEMException .criticalError ("I/O Error while executing" , e );
288290 } catch (InterruptedException e ) {
@@ -383,6 +385,15 @@ public boolean equivalence(Rewriter firstDef, Rewriter secondDef, Module firstSp
383385 };
384386 }
385387
388+ private void checkOutput (File koreOutputFile , int execStatus ) {
389+ if (execStatus != 0 ) {
390+ if (!koreOutputFile .isFile ()) {
391+ throw KEMException .criticalError ("Haskell Backend execution failed with code " + execStatus
392+ + " and produced no output." );
393+ }
394+ }
395+ }
396+
386397 private String getKoreString (K initialConfiguration , Module mod , ModuleToKORE converter ) {
387398 ExpandMacros macroExpander = ExpandMacros .forNonSentences (mod , files , kompileOptions , false );
388399 K withMacros = macroExpander .expand (initialConfiguration );
0 commit comments