maschmann/php-ansible

When using `json()` failing command has output on stdout and not stderr

bambamboole opened this issue · 1 comments

When the option json() is turned on, a not successful execution has its output in on stdout and not on stderr.

I am not sure whats the best way to get around the issue, that a failing execution does not output anything

Option 1:
Check in runProcess if the ANSIBLE_STDOUT_CALLBACK is set to json and then return $process->getOutput() instead of $process->getErrorOutput().

Option 2:
Make the process accesible from the outside and make the user responsible to get the right output

Option 3:
just always return $process->getOutput() (don't know how it's without json enabled)

@maschmann do you accept a PR for one of these cases?