Open Hixie opened 2 years ago
what target system do you see this kind of flakiness, I ran the following code in a loop on my linux workstation and it always seems to return an exit code of 0.
import 'dart:io';
main() {
final ProcessResult result =
Process.runSync('uname', <String>['-m']);
if (result.exitCode != 0) {
print(
'Encountered an error trying to run "uname -m":\n'
' exit code: ${result.exitCode}\n'
' stdout: ${result.stdout.trimRight()}\n'
' stderr: ${result.stderr.trimRight()}\n'
);
} else {
print(' exit code: ${result.exitCode}\n'
' stdout: ${result.stdout.trimRight()}');
}
}
Where I saw it was on the Linux CI in Luci. I don't know how common it is or what the cause could be.
I get into same problem. I'm running command dpkg -s certbot
to see if certbot is installed. In console, exit code is 0 when it is installed and 1 if not. But in Dart, running Process.runSync, exit code is always 0. This is painful.
UPDATE: Using Process.start method works fine, so I can say there is a bug in Dart Process.runSync (and maybe also in Process.run).
Dart SDK version: 2.18.5 (stable) (Tue Nov 22 15:47:29 2022 +0000) on "linux_x64". System: Debian 9.5 (WSL on Windows 10) x64
We (Flutter) run
uname -m
as part of our CI automation.Every now and then, this exits with a non-zero exit code (though the program still runs and gives correct useful output). However, at least in the one time we've so far seen the exit code, it was outside the expected range of -255..255, it was 1080567520.
Logs: https://ci.chromium.org/ui/p/flutter/builders/try/Linux%20framework_tests_widgets/10782/overview
Source (where we call
uname
): https://github.com/flutter/flutter/blob/master/packages/flutter_tools/lib/src/base/os.dart#L271I followed this code all the way to Dart's runtime/bin/process_linux.cc but then got lost. I didn't see anything between the
os.dart
code above andruntime/bin/process_linux.cc
that could explain the value being outside the expected range.