blueloveTH 2 лет назад
Родитель
Сommit
0b2d54f88d
1 измененных файлов с 3 добавлено и 2 удалено
  1. 3 2
      src/main.cpp

+ 3 - 2
src/main.cpp

@@ -66,14 +66,15 @@ int main(int argc, char** argv){
         filepath = std::filesystem::absolute(filepath);
         if(!std::filesystem::exists(filepath)){
             std::cerr << "File not found: " << argv_1 << std::endl;
-            return 1;
+            return 2;
         }        
         std::ifstream file(filepath);
         if(!file.is_open()){
             std::cerr << "Failed to open file: " << argv_1 << std::endl;
-            return 1;
+            return 3;
         }
         std::string src((std::istreambuf_iterator<char>(file)), std::istreambuf_iterator<char>());
+        file.close();
 
         // set parent path as cwd
         std::filesystem::current_path(filepath.parent_path());