From 6a99f2969503a7ecf388ff214b803925cfb8e1cb Mon Sep 17 00:00:00 2001 From: leedongmyung Date: Thu, 2 Jan 2025 20:05:19 +0900 Subject: [PATCH] process update --- lib/platform/process.dart | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/platform/process.dart b/lib/platform/process.dart index 81a31f0..71397a1 100644 --- a/lib/platform/process.dart +++ b/lib/platform/process.dart @@ -31,7 +31,8 @@ class ProcessData { ProcessData(this._enableStdout, this._enableStderr, {LogHandler? logHandler, Converter, String>? decoder}) { _logHandler = logHandler; - _decoder = decoder ?? utf8.decoder; + _decoder = + Platform.isWindows ? SystemEncoding().decoder : decoder ?? utf8.decoder; } bool get isSuccess { @@ -225,10 +226,10 @@ class ProcessExecutor { await file.delete(); } file.createSync(); - file.writeAsStringSync(shell.toString()); + file.writeAsStringSync(shell.toString(), flush: true); try { - processData.process = await Process.start('cmd', ['/C', file.path], - workingDirectory: workspace, runInShell: false); + processData.process = await Process.start( + 'powershell.exe', ['-NoProfile', '-File', file.absolute.path]); } on Exception catch (e) { logHandler ?? (e, LogType.error); }