-
Notifications
You must be signed in to change notification settings - Fork 304
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TaskExitException should contain the error output #1153
Comments
Is this fixed by #1152? |
It does not fix it. Something like this fixes it: diff --git a/src/Common/ExecTrait.php b/src/Common/ExecTrait.php
index 9959d304..b944cad0 100644
--- a/src/Common/ExecTrait.php
+++ b/src/Common/ExecTrait.php
@@ -395,11 +395,20 @@ trait ExecTrait
$this->startTimer();
$this->process->run($output_callback);
$this->stopTimer();
- return new ResultData(
- $this->process->getExitCode(),
- $this->process->getOutput(),
- $this->getResultData()
- );
+
+ if ($this->process->isSuccessful()) {
+ return new ResultData(
+ $this->process->getExitCode(),
+ $this->process->getOutput(),
+ $this->getResultData()
+ );
+ } else {
+ return new ResultData(
+ $this->process->getExitCode(),
+ $this->process->getErrorOutput(),
+ $this->getResultData()
+ );
+ }
}
try { But I suppose people may rely on the ResultData always containing the output. private function exitEarly($status)
{
throw new TaskExitException($this->getTask(), $this->getErrorOutput(), $status);
} |
Yes, I agree that switching the output in the result data from stdout to stderr in error conditions would be undesirable. I haven't evaluated the impact of changing the things stored in a the result data, or how such data would be handled, and the backwards-compatibility implications thereof, but a backwards compatible fix / improvement in this area would be welcome. |
This is a followup to findings in #919.
Steps to reproduce
We have a task like this:
Expected behavior
If the exception contained the error output, it would be quite readable (with the error easily spotted at the end):
Actual behavior
It displays this:
This confuses our users because the error is buried between the long output printed twice so it is hard to find.
System Configuration
PHP 8.1.27 on Linux Mint 21
The text was updated successfully, but these errors were encountered: