Unverified Commit 9c73e91f authored by Ian Hickson's avatar Ian Hickson Committed by GitHub

Add more detail to error messages (#94820)

parent be0e3886
...@@ -184,20 +184,22 @@ class _PosixUtils extends OperatingSystemUtils { ...@@ -184,20 +184,22 @@ class _PosixUtils extends OperatingSystemUtils {
@override @override
void chmod(FileSystemEntity entity, String mode) { void chmod(FileSystemEntity entity, String mode) {
// Errors here are silently ignored (except when tracing).
try { try {
final ProcessResult result = _processManager.runSync( final ProcessResult result = _processManager.runSync(
<String>['chmod', mode, entity.path], <String>['chmod', mode, entity.path],
); );
if (result.exitCode != 0) { if (result.exitCode != 0) {
_logger.printTrace( _logger.printTrace(
'Error trying to run chmod on ${entity.absolute.path}' 'Error trying to run "chmod $mode ${entity.path}":\n'
'\nstdout: ${result.stdout}' ' exit code: ${result.exitCode}\n'
'\nstderr: ${result.stderr}', ' stdout: ${result.stdout.toString().trimRight()}\n'
' stderr: ${result.stderr.toString().trimRight()}'
); );
} }
} on ProcessException catch (error) { } on ProcessException catch (error) {
_logger.printTrace( _logger.printTrace(
'Error trying to run chmod on ${entity.absolute.path}: $error', 'Error trying to run "chmod $mode ${entity.path}": $error',
); );
} }
} }
...@@ -268,20 +270,22 @@ class _PosixUtils extends OperatingSystemUtils { ...@@ -268,20 +270,22 @@ class _PosixUtils extends OperatingSystemUtils {
@override @override
HostPlatform get hostPlatform { HostPlatform get hostPlatform {
if (_hostPlatform == null) { if (_hostPlatform == null) {
final RunResult hostPlatformCheck = final RunResult hostPlatformCheck = _processUtils.runSync(<String>['uname', '-m']);
_processUtils.runSync(<String>['uname', '-m']);
// On x64 stdout is "uname -m: x86_64" // On x64 stdout is "uname -m: x86_64"
// On arm64 stdout is "uname -m: aarch64, arm64_v8a" // On arm64 stdout is "uname -m: aarch64, arm64_v8a"
if (hostPlatformCheck.exitCode != 0) { if (hostPlatformCheck.exitCode != 0) {
_hostPlatform = HostPlatform.linux_x64;
_logger.printError( _logger.printError(
'Error trying to run uname -m' 'Encountered an error trying to run "uname -m":\n'
'\nstdout: ${hostPlatformCheck.stdout}' ' exit code: ${hostPlatformCheck.exitCode}\n'
'\nstderr: ${hostPlatformCheck.stderr}', ' stdout: ${hostPlatformCheck.stdout.trimRight()}\n'
' stderr: ${hostPlatformCheck.stderr.trimRight()}\n'
'Assuming host platform is ${getNameForHostPlatform(_hostPlatform!)}.',
); );
_hostPlatform = HostPlatform.linux_x64;
} else if (hostPlatformCheck.stdout.trim().endsWith('x86_64')) { } else if (hostPlatformCheck.stdout.trim().endsWith('x86_64')) {
_hostPlatform = HostPlatform.linux_x64; _hostPlatform = HostPlatform.linux_x64;
} else { } else {
// We default to ARM if it's not x86_64 and we did not get an error.
_hostPlatform = HostPlatform.linux_arm64; _hostPlatform = HostPlatform.linux_arm64;
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment