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: https://travis-ci.org/HeliumProject/Core/jobs/472860165

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: https://travis-ci.org/HeliumProject/Core/jobs/473127100, which just does a vswhere -products *, which should reveal install properties of visual studio build tools mentioned here: https://github.com/Microsoft/vswhere/issues/22

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`
	fi

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: https://travis-ci.com/apjanke/travis-octave-windows/jobs/173331912