-
-
Notifications
You must be signed in to change notification settings - Fork 75
feat(shell): introduce error output behavior feature #334
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
Conversation
@Ocramius support for https://github.com/laminas/automatic-releases/blob/f4a0b35bf35db0b8a66adcf9b557d4709e4b533f/src/Gpg/ImportGpgKeyFromStringViaTemporaryFile.php#L20-L21 without disabling escaping ;) |
Pull Request Test Coverage Report for Build 2286989541
💛 - Coveralls |
@azjezz not sure I follow 🤔 |
enum ErrorOutputBehavior { | ||
/** | ||
* Discard the standard error output. | ||
*/ | ||
case DISCARD; | ||
|
||
/** | ||
* Append the standard error output content to the standard output content. | ||
*/ | ||
case APPEND; | ||
|
||
/** | ||
* Prepend the standard error output content to the standard output content. | ||
*/ | ||
case PREPEND; | ||
|
||
/** | ||
* Replace the standard output content with the standard error output content. | ||
*/ | ||
case REPLACE; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
feature behaviors to include:
- merge: merge both stdout and stderr, the order is not guaranteed, as both streams will be read concurrently, and which ever returns first will be first, this doesn't mean that one will come after the over, as stdout can write a chunk, then stderr, then stdout, so it will be mixed ( exactly what you see in your terminal when stderr is not redirected )
- redirect: redirect the stderr output of the process, to the stderr output of the current process.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#335 introduces a streaming function which helps implement the merge, and redirect behaviors.
in laminas automatic release we had to disable escaping to redirect stderr to stdout, since gpg writes the key to stderr, now that is not needed since you can do: $stderr = Shell\execute('gpg', ['--import', $keyFileName], error_output_behavior: ErrorOutputBehavior::Replace); instead of: $stderr = Shell\execute('gpg', ['--import', Shell\escape_argument($keyFileName), '2>&1'], escape_arguments: false); |
b941ee3
to
366a6ac
Compare
Signed-off-by: azjezz <azjezz@protonmail.com>
366a6ac
to
e2581de
Compare
credits for this idea goes to @fredemmott ( facebook/hhvm#8946 (reply in thread) )