[jboss-jira] [JBoss JIRA] (WFLY-3578) jboss-cli.bat always exits with return code 0 even after a cli failure

Gabriele Garuglieri (JIRA) issues at jboss.org
Mon Jul 7 08:50:26 EDT 2014


    [ https://issues.jboss.org/browse/WFLY-3578?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12982623#comment-12982623 ] 

Gabriele Garuglieri commented on WFLY-3578:
-------------------------------------------

Sorry my fault, i was so focused i forgot you obviously cannot see the point! I'll try to explain better.

I'm calling the bat from a python framework that create a cmd process, execute the bat in it and check the process exit code.
If the bat is not exited explicitly with exit as above the process exit code is always zero.
exit /B %RC%, when the cmd process is created only to process the bat and then terminated, has the effect to set the process exit code with what is also put in errorlevel.


> jboss-cli.bat always exits with return code 0 even after a cli failure
> ----------------------------------------------------------------------
>
>                 Key: WFLY-3578
>                 URL: https://issues.jboss.org/browse/WFLY-3578
>             Project: WildFly
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>          Components: CLI
>    Affects Versions: 8.1.0.Final
>         Environment: Windows
>            Reporter: Gabriele Garuglieri
>            Assignee: Alexey Loubyansky
>
> jboss-cli.bat cannot be reliably controlled by other scripts because it does not report return code from cli execution and  always exits with 0 even after a failure.
> It can be solved with the following patch:
> {noformat}
> --- C:/home/JBoss/wildfly-8.1.0.Final/bin/jboss-cli-orig.bat	Sat May 31 04:54:25 2014
> +++ C:/home/JBoss/wildfly-8.1.0.Final/bin/jboss-cli.bat	Thu Jul 03 10:19:09 2014
> @@ -1,4 +1,5 @@
>  @echo off
> +setlocal ENABLEEXTENSIONS
>  rem -------------------------------------------------------------------------
>  rem JBoss Admin CLI Script for Windows
>  rem -------------------------------------------------------------------------
> @@ -48,6 +49,7 @@
>  if not exist "%JBOSS_RUNJAR%" (
>    echo Could not locate "%JBOSS_RUNJAR%".
>    echo Please check that you are in the bin directory when running this script.
> +  set /A RC=1
>    goto END
>  )
>  
> @@ -71,5 +73,11 @@
>       org.jboss.as.cli ^
>       %*
>  
> +set /A RC=%errorlevel%
>  :END
>  if "x%NOPAUSE%" == "x" pause
> +
> +if "x%RC%" == "x" (
> +  set /A RC=0
> +)
> +exit /B %RC%
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.2.6#6264)


More information about the jboss-jira mailing list