[web] collect macOS info only on bot; propagate errors (flutter/engine#27089)

This commit is contained in:
Yegor 2021-07-01 13:08:49 -07:00 committed by GitHub
parent 72d7ac4ba4
commit fce4cc3d39
2 changed files with 8 additions and 21 deletions

View File

@ -11,23 +11,9 @@ class MacOSInfo {
///
/// Built in tools such as `system_profiler` and `defaults` are utilized.
Future<void> printInformation() async {
try {
await _printSafariApplications();
} catch (error) {
print('Error thrown while getting Safari Applications: $error');
}
try {
await _printSafariDefaults();
} catch (error) {
print('Error thrown while getting Safari defaults: $error');
}
try {
await _printUserLimits();
} catch (error) {
print('Error thrown while getting user limits defaults: $error');
}
await _printSafariApplications();
await _printSafariDefaults();
await _printUserLimits();
}
/// Print information on applications in the system that contains string
@ -59,17 +45,18 @@ class MacOSInfo {
final ProcessManager defaults = await startProcess(
'/usr/bin/defaults',
['find', 'Safari'],
evalOutput: true,
);
print('Safari related defaults:\n ${await defaults.evalStdout()}');
}
/// Print user limits (file and process).
Future<void> _printUserLimits() async {
ProcessManager ulimit = await startProcess('ulimit', ['-n']);
ProcessManager ulimit = await startProcess('ulimit', ['-n'], evalOutput: true);
final String fileLimit = await ulimit.evalStdout();
print('MacOS file limit: $fileLimit');
ulimit = await startProcess('ulimit', ['-u']);
ulimit = await startProcess('ulimit', ['-u'], evalOutput: true);
final String processLimit = await ulimit.evalStdout();
print('MacOS process limit: $processLimit');
}

View File

@ -187,8 +187,8 @@ class TestCommand extends Command<bool> with ArgUtils {
..argParsers.forEach((t) => t.parseOptions(argResults!));
GeneralTestsArgumentParser.instance.parseOptions(argResults!);
if (isSafariOnMacOS) {
/// Collect information on the bot.
/// Collect information on the bot.
if (isSafariOnMacOS && isLuci) {
final MacOSInfo macOsInfo = new MacOSInfo();
await macOsInfo.printInformation();
}