From 5e01e0fb38a56358326f50773eba3cd8f3ff0491 Mon Sep 17 00:00:00 2001 From: wyq0918dev Date: Mon, 15 Jun 2026 20:53:18 +0800 Subject: [PATCH] fix: Missing extension byte on non-English Windows. --- lib/src/process.dart | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/src/process.dart b/lib/src/process.dart index 4b93337..21a5aae 100644 --- a/lib/src/process.dart +++ b/lib/src/process.dart @@ -26,12 +26,15 @@ Future runProcess({ runInShell: Platform.isWindows && workingDirectory != null, ); + // Windows uses system encoding (e.g., GBK for Chinese), while + // Linux/macOS use UTF-8 for process output. + final encoding = Platform.isWindows ? systemEncoding : utf8; final stdoutFuture = process.stdout - .transform(utf8.decoder) + .transform(encoding.decoder) .transform(const LineSplitter()) .forEach(stdout.writeln); final stderrFuture = process.stderr - .transform(utf8.decoder) + .transform(encoding.decoder) .transform(const LineSplitter()) .forEach(stderr.writeln); await Future.wait([stdoutFuture, stderrFuture]);