Avoid using dart:io we compiling for web

In support of http://go/clientside-dartpad

Change-Id: I379095327e724e4b136986116343dd9e30459d6b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/490560
Auto-Submit: Jonas Jensen <jonasfj@google.com>
Commit-Queue: Jonas Jensen <jonasfj@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
This commit is contained in:
Jonas Finnemann Jensen
2026-03-25 07:39:34 -07:00
committed by Commit Queue
parent 17e6648fe0
commit 71512ecc6c
@@ -119,6 +119,10 @@ void Function(String) printEnableColorsReason = (_) {};
/// Note: do not call this method directly, as it is expensive to
/// compute. Instead, use [enableColors].
bool _computeEnableColors() {
if (const bool.fromEnvironment('dart.library.js_interop')) {
printEnableColorsReason("Not enabling colors when compiled for web.");
return false;
}
if (!stdout.supportsAnsiEscapes) {
printEnableColorsReason(
"Not enabling colors, stdout does not support ANSI colors.",