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); }