Browse Source

Abort on compilation error.

tags/0.4.0
tastytea 5 months ago
parent
commit
6cd9ff8083
Signed by: tastytea <tastytea@tastytea.de> GPG Key ID: CFC39497F1B26E07
2 changed files with 8 additions and 3 deletions
  1. 1
    1
      CMakeLists.txt
  2. 7
    2
      src/main.cpp

+ 1
- 1
CMakeLists.txt View File

@@ -1,6 +1,6 @@
1 1
 cmake_minimum_required (VERSION 3.2)
2 2
 project(compilescript
3
-        VERSION 0.3.1
3
+        VERSION 0.3.2
4 4
         LANGUAGES CXX
5 5
 )
6 6
 

+ 7
- 2
src/main.cpp View File

@@ -200,8 +200,13 @@ int main(int argc, char *argv[])
200 200
             return 1;
201 201
         }
202 202
 
203
-        std::system((compiler + " " + source.string() + " " + compiler_arguments
204
-                     + " -o " + binary.string()).c_str());
203
+        int ret = std::system((compiler + " " + source.string() + " "
204
+                      + compiler_arguments + " -o " + binary.string()).c_str());
205
+        if (ret != 0)
206
+        {
207
+            cerr << "ERROR: Compilation failed.\n";
208
+            return 1;
209
+        }
205 210
     }
206 211
 
207 212
     execv(binary.c_str(), &argv[1]);

Loading…
Cancel
Save