mirror of
https://github.com/rife2/bld
synced 2025-12-20 16:48:38 +01:00
Merge pull request #32 from sombriks/main
setting exit status for unknown command
This commit is contained in:
commit
60c332d750
|
|
@ -463,6 +463,7 @@ public class BuildExecutor {
|
||||||
new HelpOperation(this, arguments()).executePrintOverviewHelp();
|
new HelpOperation(this, arguments()).executePrintOverviewHelp();
|
||||||
System.err.println();
|
System.err.println();
|
||||||
System.err.println("ERROR: unknown command '" + command + "'");
|
System.err.println("ERROR: unknown command '" + command + "'");
|
||||||
|
exitStatus(1);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -292,14 +292,16 @@ public class TestProject {
|
||||||
try {
|
try {
|
||||||
var result = new StringBuilder();
|
var result = new StringBuilder();
|
||||||
var project = new CustomProjectLambda(tmp, result);
|
var project = new CustomProjectLambda(tmp, result);
|
||||||
project.execute(new String[]{"ne2", "nc2", "n2"});
|
var status = project.execute(new String[]{"ne2", "nc2", "n2"});
|
||||||
assertEquals("newcommand2" +
|
assertEquals("newcommand2" +
|
||||||
"newcommand2" +
|
"newcommand2" +
|
||||||
"newcommand2", result.toString());
|
"newcommand2", result.toString());
|
||||||
|
assertEquals(0, status, "Exit status should be 0");
|
||||||
|
|
||||||
result = new StringBuilder();
|
result = new StringBuilder();
|
||||||
project.execute(new String[]{"c"});
|
status = project.execute(new String[]{"c"});
|
||||||
assertEquals("", result.toString());
|
assertEquals("", result.toString());
|
||||||
|
assertEquals(1, status, "Exit status should be 1");
|
||||||
} finally {
|
} finally {
|
||||||
FileUtils.deleteDirectory(tmp);
|
FileUtils.deleteDirectory(tmp);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue