Added ability to negate interpretation of the exit code.
Change-Id: Ica77a10d854f247921e6adb74f8da65de0c79c8a
Showing
1 changed file
with
5 additions
and
1 deletions
... | @@ -35,6 +35,8 @@ import static org.onlab.stc.Coordinator.print; | ... | @@ -35,6 +35,8 @@ import static org.onlab.stc.Coordinator.print; |
35 | class StepProcessor implements Runnable { | 35 | class StepProcessor implements Runnable { |
36 | 36 | ||
37 | private static final String IGNORE_CODE = "~"; | 37 | private static final String IGNORE_CODE = "~"; |
38 | + private static final String NEGATE_CODE = "!"; | ||
39 | + | ||
38 | private static final int FAIL = -1; | 40 | private static final int FAIL = -1; |
39 | 41 | ||
40 | static String launcher = "stc-launcher "; | 42 | static String launcher = "stc-launcher "; |
... | @@ -67,7 +69,9 @@ class StepProcessor implements Runnable { | ... | @@ -67,7 +69,9 @@ class StepProcessor implements Runnable { |
67 | delegate.onStart(step, command); | 69 | delegate.onStart(step, command); |
68 | int code = execute(); | 70 | int code = execute(); |
69 | boolean ignoreCode = step.env() != null && step.env.equals(IGNORE_CODE); | 71 | boolean ignoreCode = step.env() != null && step.env.equals(IGNORE_CODE); |
70 | - Status status = ignoreCode || code == 0 ? SUCCEEDED : FAILED; | 72 | + boolean negateCode = step.env() != null && step.env.equals(NEGATE_CODE); |
73 | + Status status = ignoreCode || code == 0 && !negateCode || code != 0 && negateCode ? | ||
74 | + SUCCEEDED : FAILED; | ||
71 | delegate.onCompletion(step, status); | 75 | delegate.onCompletion(step, status); |
72 | } | 76 | } |
73 | 77 | ... | ... |
-
Please register or login to post a comment