[ 
https://issues.jenkins-ci.org/browse/JENKINS-14023?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

vjuranek resolved JENKINS-14023.
--------------------------------

    Resolution: Not A Defect

Hi, system groovy scripts (which also is groovy scripts called via CLI) run in 
same JVM as Jenkins master, so there's no surprise that System.exit() kills 
your Jenkins master - it's expected behavior. Throwing an exception is 
definitely better approach how to announce some problem in the script. Closing 
as No a bug. 
                
> System.exit (13) in a groovy script causes Jenkins shutdown
> -----------------------------------------------------------
>
>                 Key: JENKINS-14023
>                 URL: https://issues.jenkins-ci.org/browse/JENKINS-14023
>             Project: Jenkins
>          Issue Type: Bug
>          Components: groovy
>    Affects Versions: current
>         Environment: Solaris
>            Reporter: pan berecik
>            Assignee: vjuranek
>
> I want to return an error from my groovy script and used for it 
> System.exit(13).It caused shutdown of jenkins.
> The script was startet using jenkins-cli.
> ...
> if(args.length < 2){
>    System.exit(13)
> }
> ...
> Finally I found a workaround and use RuntimeException in my script and the 
> job finished as expected as failed. But jenkins cann still continue his work 
> :)
> ...
>  if(args.length < 2){
>       throw new RuntimeException("Mandatory Parameter BRANCH_NAME is missing! 
> Operation ist aborted!")  
>   }
> ...

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.jenkins-ci.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to