installdependencies.sh prints incorrect return value in case of apt-get error
Describe the bug Lines https://github.com/actions/runner/blob/ca2b1bc6d5eb87339966571a8ad453adcdca4cf2/src/Misc/layoutbin/installdependencies.sh#L69-L72 do not print out the actual error. The "$?" variable gets cleared with if -command.
FIX: Store the error code to a temporary variable before if, and then use that variable in both if and echo.
Also it would be good to print out the failing command line, like
apt_get update && $apt_get install -y libkrb5-3 zlib1g failed with error code 7.
To Reproduce
Disconnect net when running the script.
Expected behavior Should print the error code returnted by apt-get
Runner Version and Platform
Version of your runner? ??
OS of the machine running the runner? OSX/Windows/Linux/... Linux
What's not working?
Error printing
Job Log Output
N/A
Runner and Worker's Diagnostic Logs
N/A