fastlane-plugin-flutter icon indicating copy to clipboard operation
fastlane-plugin-flutter copied to clipboard

When capturing_stdout also print the stdout in case of error

Open joecks opened this issue 3 years ago • 2 comments
trafficstars

When capturing_stdout:true is set and the flutter command fails, we also need to know what the stdout contained in order to understand the context of the issue.

          unless wait_thread.value.success? || (ignore_error == true)
            UI.shell_error!(<<-ERROR)
The following command has failed:
$ #{command}
[#{wait_thread.value}]

#{errors_thread.value}

Command output:
#[output]
ERROR
          end

          ignore_error
        end

I could also imagine to configure this with a parameter. This behaviour is a bit annoying when running command on the CI, and errors can not be reproduced locally.

joecks avatar Jul 04 '22 15:07 joecks

Agree. The general expectation is that the call site would play nicely as well and spit the output when necessary (that's what... Capturing means). I can understand the overhead in writing that code, but I also found stdout too noisy most of the time and containing a lot of redherring distracting from actual troubleshooting. Especially the build command. Do you happen to have an example of what command would fail and conceal context in stdout, so that I can play with verbosity a bit to find a way to guess the intent?

Providing an argument sounds good anyway.

dotdoom avatar Jul 04 '22 16:07 dotdoom

From our project: https://github.com/xaynetwork/xayn_discovery_app/runs/7152843111?check_suite_focus=true#step:8:532

it basically only prints that we had an error:

The following command has failed:
$ /Users/runner/hostedtoolcache/flutter/bin/flutter build ios --release --build-number\=1419 --build-name\=3.41.0-31-gbb01e5a5 --dart-define\=GIT_TAG\=3.41.0-31-gbb01e5a5 --dart-define\=USER_APP_ID\=com.xayn.discovery.internal --dart-define\=USER_APP_NAME\=Xayn\ News\[i\] --dart-define\=USER_FLAVOR\=internal --dart-define\=USER_PROVISIONING_PROFILE\=Xayn\ Discovery\ Internal\ Adhoc\ Profile --dart-define\=USER_CERTIFICATE\=Apple\ Distribution:\ Xayn\ AG\ \(586TQ875ST\) --no-codesign --bundle-sksl-path flutter_01.sksl.json
[pid 32725 exit 1]
Encountered error while building for device.

And stdout reported a warning that the SKSL kernel file doesn't match the Flutter version. It was basically the last print statement before it failed. Generally in my experience, all flutter commands might report a warning or an error to STDOUT instead of STDERR and just fail with a short message.

joecks avatar Jul 05 '22 07:07 joecks