Factor workunit failure into final exit code.

Review Request #4244 - Created Sept. 17, 2016 and submitted

Information
Yi Cheng
pants
3882
Reviewers
pants-reviews
benjyw, kwlzn, nhoward_tw, peiyu, stuhood, zundel

Previously if a workunit fails, the run will end with Pants printing FAILURE, but the exit code is 0.

This change factors the result of workunit into the final exit code as well.

Before:

$ ./pants --pythonpath=tests/python --backend-packages=pants_test.goal.data do-some-work

23:41:53 00:00 [main]
               (To run a reporting server: ./pants server)
23:41:53 00:00   [setup]
23:41:53 00:00     [parse]
               Executing tasks in goals: bootstrap -> do-some-work
23:41:54 00:01   [bootstrap]
23:41:54 00:01     [substitute-aliased-targets]
23:41:54 00:01     [jar-dependency-management]
23:41:54 00:01     [bootstrap-jvm-tools]
23:41:54 00:01     [provide-tools-jar]
23:41:54 00:01   [do-some-work]
23:41:54 00:01     [do-some-work]
23:41:54 00:01       [non.existent.main.class]
                     ==== stderr ====
                     java.lang.ClassNotFoundException: non.existent.main.class
                        at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
                        at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
                        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
                        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
                        at java.lang.Class.forName0(Native Method)
                        at java.lang.Class.forName(Class.java:264)
                        at com.martiansoftware.nailgun.NGSession.run(NGSession.java:242)

                     ==== stdout ====

23:41:54 00:01   [complete]
               FAILURE

$ echo $?
0

After:

$ ./pants --pythonpath=tests/python --backend-packages=pants_test.goal.data do-some-work

23:41:53 00:00 [main]
               (To run a reporting server: ./pants server)
23:41:53 00:00   [setup]
23:41:53 00:00     [parse]
               Executing tasks in goals: bootstrap -> do-some-work
23:41:54 00:01   [bootstrap]
23:41:54 00:01     [substitute-aliased-targets]
23:41:54 00:01     [jar-dependency-management]
23:41:54 00:01     [bootstrap-jvm-tools]
23:41:54 00:01     [provide-tools-jar]
23:41:54 00:01   [do-some-work]
23:41:54 00:01     [do-some-work]
23:41:54 00:01       [non.existent.main.class]
                     ==== stderr ====
                     java.lang.ClassNotFoundException: non.existent.main.class
                        at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
                        at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
                        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
                        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
                        at java.lang.Class.forName0(Native Method)
                        at java.lang.Class.forName(Class.java:264)
                        at com.martiansoftware.nailgun.NGSession.run(NGSession.java:242)

                     ==== stdout ====

23:41:54 00:01   [complete]
               FAILURE

$ echo $?
1

https://travis-ci.org/pantsbuild/pants/builds/161491405

Issues

  • 0
  • 1
  • 0
  • 1
Description From Last Updated
Peiyu Wang
Yi Cheng
Kris Wilson
Benjy Weinberger
Nick Howard (Twitter)
Yi Cheng
Nick Howard (Twitter)
Yi Cheng
Review request changed

Status: Closed (submitted)

Change Summary:

b30acb6f857f938b82809317742bc57444683432 thanks gents!

Loading...