@@ -138,6 +138,8 @@ class BackgroundProcess {
138138 * If <code>timeoutMS</code> is set to value > 0, waits up to the given timespan for the process exists and returns either null or the exit code.
139139 * If <code>timeoutMS</code> is set to `-1`, waits indefinitely until the process exists.
140140 * If <code>timeoutMS</code> is set to value lower than -1, results in an exception.
141+ *
142+ * @return the exit code or null
141143 */
142144 public function awaitExit (timeoutMS : Int ): Null <Int > {
143145 Threads .await (() -> exitCode != null , timeoutMS );
@@ -152,17 +154,21 @@ class BackgroundProcess {
152154 * If <code>timeoutMS</code> is set to `-1`, waits indefinitely until the process exists.
153155 * If <code>timeoutMS</code> is set to value lower than -1, results in an exception.
154156 *
157+ * @return `true` if process exited successful, `false` if process is still running
155158 * @throws if exitCode != 0
156159 */
157- public function awaitSuccess (timeoutMS : Int , includeStdErr = true ): Void {
160+ public function awaitSuccess (timeoutMS : Int , includeStdErr = true ): Bool {
158161 final exitCode = awaitExit (timeoutMS );
159162 if (exitCode == 0 )
160- return ;
163+ return true ;
164+
165+ if (exitCode == null )
166+ return false ;
161167
162168 if (includeStdErr )
163- throw ' Process failed with exit code $exitCode and error message: ${stderr .readAll ()}' ;
169+ throw ' Process [cmd= $ cmd ,pid= $ pid ] failed with exit code $exitCode and error message: ${stderr .readAll ()}' ;
164170
165- throw ' Process failed with exit code $exitCode ' ;
171+ throw ' Process [cmd= $ cmd ,pid= $ pid ] failed with exit code $exitCode ' ;
166172 }
167173
168174 /**
0 commit comments