Project

General

Profile

Actions

Feature #2045

closed

Make IdMTool return POSIX.1-correct return codes

Added by Petr Fišer almost 5 years ago. Updated almost 5 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Radek Tomiška
Category:
Continuous development
Target version:
Start date:
02/10/2020
Due date:
% Done:

100%

Estimated time:
Owner:

Description

When building with IdMtool, it is not easy to determine if the build failed - the tool always returns 0 return code upon exit regardless the action being successful or not. This is clunky when used inside an automated workflow.

Please enhance the tool that:
  • 0 = everything successful
  • non-zero (1-255 range) = failure
  • AFAIK when printing the help, the return codes vary per binary... but I think the suitable is:
    • when specifically asking for --help or similar, return code should be 0
    • when printing the help as a result of bad params/other failure, return code should be non-zero

As far as non-zero codes go, it is totally up to you... I would use 1,2,... low integers.

Example:

[root@czechidm tool]# java -jar idm-tool.jar -p --build
2020-02-10 12:52:28.827  INFO   --- [           main] eu.bcvsolutions.idm.tool.ConsoleRunner   : Running tool with arguments [project, build].
2020-02-10 12:52:29.353 ERROR   --- [           main] e.b.idm.tool.service.impl.MavenManager   : /idmbuild/maven/current/bin/mvn: line 93: which: command not found
2020-02-10 12:52:29.353 ERROR   --- [           main] e.b.idm.tool.service.impl.MavenManager   : The JAVA_HOME environment variable is not defined correctly
2020-02-10 12:52:29.353 ERROR   --- [           main] e.b.idm.tool.service.impl.MavenManager   : This environment variable is needed to run this program
2020-02-10 12:52:29.353 ERROR   --- [           main] e.b.idm.tool.service.impl.MavenManager   : NB: JAVA_HOME should point to a JDK not a JRE
2020-02-10 12:52:29.359 ERROR   --- [           main] e.b.idm.tool.service.impl.MavenManager   : Execute maven command failed [exit code: 1].
2020-02-10 12:52:29.428 ERROR   --- [           main] eu.bcvsolutions.idm.tool.ConsoleRunner   : Build failed [Execute maven command failed [exit code: 1].]
[root@czechidm tool]# echo $?
0


Related issues

Related to IdStory Identity Manager - Task #1504: Create new application for release (IdmTool) ClosedVít Švanda02/14/2019

Actions
Actions

Also available in: Atom PDF