process udpate
This commit is contained in:
parent
9b9b7a3ef8
commit
abeafdaf37
1 changed files with 15 additions and 9 deletions
|
|
@ -226,6 +226,8 @@ class ProcessExecutor {
|
|||
static Future<ProcessResult> run(StringBuffer shell,
|
||||
{String? workspace,
|
||||
bool printStdout = true,
|
||||
bool printStderr = true,
|
||||
Converter<List<int>, String>? decoder,
|
||||
LogHandler? logHandler}) async {
|
||||
var c = Completer<ProcessResult>();
|
||||
workspace = workspace ?? Directory.systemTemp.path;
|
||||
|
|
@ -248,15 +250,21 @@ class ProcessExecutor {
|
|||
file.writeAsStringSync(shell.toString());
|
||||
try {
|
||||
var shellExe = Platform.isMacOS ? 'zsh' : 'bash';
|
||||
await Process.run(shellExe, [file.path], workingDirectory: workspace)
|
||||
.then((ProcessResult result) {
|
||||
processResult = result;
|
||||
});
|
||||
processResult = await Process.run(shellExe, [file.path],
|
||||
workingDirectory: workspace);
|
||||
if (printStdout) {
|
||||
logHandler ??
|
||||
(
|
||||
// ignore: prefer_interpolation_to_compose_strings
|
||||
'[ProcessExecutor] Exit Code: ${processResult!.exitCode}\nResult: ${processResult!.stdout}\nError: ${processResult!.stderr}',
|
||||
'[ProcessExecutor] Result: ${processResult.stdout}',
|
||||
LogType.verbose
|
||||
);
|
||||
}
|
||||
if (printStderr) {
|
||||
logHandler ??
|
||||
(
|
||||
// ignore: prefer_interpolation_to_compose_strings
|
||||
'[ProcessExecutor] Exit Code: ${processResult.exitCode}\nError: ${processResult.stderr}',
|
||||
LogType.verbose
|
||||
);
|
||||
}
|
||||
|
|
@ -269,10 +277,8 @@ class ProcessExecutor {
|
|||
} else if (Platform.isWindows) {
|
||||
file.createSync();
|
||||
file.writeAsStringSync(shell.toString());
|
||||
await Process.run('cmd', ['/C', file.path], workingDirectory: workspace)
|
||||
.then((ProcessResult result) {
|
||||
processResult = result;
|
||||
});
|
||||
processResult = await Process.run('cmd', ['/C', file.path],
|
||||
workingDirectory: workspace);
|
||||
if (printStdout) {
|
||||
// print(
|
||||
// // ignore: prefer_interpolation_to_compose_strings
|
||||
|
|
|
|||
Loading…
Reference in a new issue