Set an error code if project was not inserted successfully.
authorDavid ‘Bombe’ Roden <bombe@freenetproject.org>
Thu, 9 Jun 2011 18:54:54 +0000 (20:54 +0200)
committerDavid ‘Bombe’ Roden <bombe@freenetproject.org>
Thu, 3 Nov 2011 07:45:18 +0000 (08:45 +0100)
This fixes #47.

src/de/todesbaum/jsite/main/CLI.java

index c97d8e1..2c5edbd 100644 (file)
@@ -157,9 +157,11 @@ public class CLI implements InsertListener {
                        }
                }
 
+               int errorCode = 1;
                if (currentProject != null) {
                        if (insertProject(currentProject)) {
                                outputWriter.println("Project \"" + currentProject.getName() + "\" successfully inserted.");
+                               errorCode = 0;
                        } else {
                                outputWriter.println("Project \"" + currentProject.getName() + "\" was not successfully inserted.");
                        }
@@ -167,6 +169,8 @@ public class CLI implements InsertListener {
 
                configuration.setProjects(projects);
                configuration.save();
+
+               System.exit(errorCode);
        }
 
        /**