Stderr tty appears later in log / visual studio build tools + vswhere

I ported over the shell scripts from my linux/osx project, and did a sanity check of the scripts on git-bash on windows, but when those scripts run on travis I get failing exit codes and no tty:

Oh, wait, there is a bunch of bash error tty later in the log… maybe somehow the bash context on the worker is significantly different than on linux/macos…

So it appears stderr from child bash scripts do get pushed to the end of the log.

My script uses vswhere to local visual studio, but it’s not showing any visual studio build tools installed: see before_install here:, which just does a vswhere -products *, which should reveal install properties of visual studio build tools mentioned here:

Ah ha, you have to do this:

vswhere -products ‘Microsoft.VisualStudio.Product.BuildTools’

In my bash I ended up:

	VSINSTALL=`"/c/Program Files (x86)/Microsoft Visual Studio/Installer/vswhere.exe" -property installationPath`
	if [ -z "$VSINSTALL" ]; then
		VSINSTALL=`"/c/Program Files (x86)/Microsoft Visual Studio/Installer/vswhere.exe" -products 'Microsoft.VisualStudio.Product.BuildTools' -property installationPath`

This will fetch the install dir of a full install (desktop configs), then fall back to the build tools product.

I’m having the same issue with all the error output from my commands showing up at the bottom of the script instead of in or after the script step which produced the error output.

Example build: