This commit is contained in:
leedongmyung 2023-11-12 20:12:38 +09:00
parent 69793a91f2
commit 061b8e099e
2 changed files with 9 additions and 8 deletions

View file

@ -5,7 +5,6 @@ import 'dart:math';
import 'dart:typed_data';
import 'package:dart_framework/charset/euc_kr.dart';
import 'package:dart_framework/cp949.dart' as cp949;
class ProcessData {
late Process process;
@ -194,14 +193,20 @@ class ProcessExecutor {
print('Execute Bat: ${file.path} \n ${shell.toString()}');
file.createSync();
file.writeAsStringSync(shell.toString());
await Process.run('cmd', ['/C', file.path], workingDirectory: workspace)
await Process.run('cmd', ['/C', file.path],
workingDirectory: workspace,
stdoutEncoding: Encoding.getByName('euc-kr'),
stderrEncoding: Encoding.getByName('euc-kr'))
.then((ProcessResult result) {
processResult = result;
});
if (printStdout) {
Uint8List out = processResult!.stdout;
Uint8List err = processResult!.stderr;
print(
// ignore: prefer_interpolation_to_compose_strings
'[ProcessExecutor] Exit Code: ${processResult!.exitCode}, Result: ${cp949.decodeString(processResult!.stdout)}\nError: ${cp949.decodeString(processResult!.stderr)}');
'[ProcessExecutor] Exit Code: ${processResult!.exitCode}, Result: ${eucKr.decode(out)}\nError: ${eucKr.decode(err)}');
}
file.deleteSync();
c.complete(processResult);

View file

@ -15,11 +15,7 @@ dependencies:
ftpconnect: ^2.0.5
yaml: ^3.1.1
http: ^0.13.5
color: ^3.0.0
cp949:
git:
url: https://github.com/dong-higenis/dart-cp949
ref: main
color: ^3.0.0
# subtitle_wrapper_package: ^2.1.1
# equatable: ^2.0.5