print stdout 정리
This commit is contained in:
parent
962861b74e
commit
50215182ef
1 changed files with 20 additions and 10 deletions
|
|
@ -113,12 +113,15 @@ class ProcessData {
|
|||
class ProcessExecutor {
|
||||
static Future<ProcessData> startExe(String exe, List<String> args,
|
||||
{String? workspace, bool? printStdout, bool? printStderr}) async {
|
||||
var c = Completer<ProcessData>();
|
||||
var arg = '$exe ${args.join(' ')}';
|
||||
var processData = ProcessData(printStdout ?? true, printStderr ?? true);
|
||||
var printStdout_ = printStdout ?? true;
|
||||
var printStderr_ = printStderr ?? true;
|
||||
var processData = ProcessData(printStdout_, printStderr_);
|
||||
if (Platform.isMacOS || Platform.isWindows) {
|
||||
workspace = workspace ?? Directory.systemTemp.path;
|
||||
print('Execute Shell: $arg');
|
||||
if(printStdout_) {
|
||||
print('Execute Shell: $arg');
|
||||
}
|
||||
try {
|
||||
processData.processValue =
|
||||
await Process.start(exe, args, workingDirectory: workspace);
|
||||
|
|
@ -128,8 +131,7 @@ class ProcessExecutor {
|
|||
} else {
|
||||
print('This platform not support process executor.');
|
||||
}
|
||||
c.complete(processData);
|
||||
return c.future;
|
||||
return dataFutrue(processData);
|
||||
}
|
||||
|
||||
static Future<ProcessData> start(StringBuffer shell,
|
||||
|
|
@ -139,7 +141,9 @@ class ProcessExecutor {
|
|||
bool? printStderr}) async {
|
||||
var c = Completer<ProcessData>();
|
||||
try {
|
||||
var processData = ProcessData(printStdout ?? true, printStderr ?? true);
|
||||
var printStdout_ = printStdout ?? true;
|
||||
var printStderr_ = printStderr ?? true;
|
||||
var processData = ProcessData(printStdout_, printStderr_);
|
||||
if (decoder != null) {
|
||||
processData.decoder = decoder;
|
||||
}
|
||||
|
|
@ -147,7 +151,9 @@ class ProcessExecutor {
|
|||
workspace = workspace ?? Directory.systemTemp.path;
|
||||
var file = File('$workspace/$tempFileName');
|
||||
processData.file = file;
|
||||
print('Execute Shell: ${file.path} \n ${shell.toString()}');
|
||||
if(printStdout_) {
|
||||
print('Execute Shell: ${file.path} \n ${shell.toString()}');
|
||||
}
|
||||
if (await file.exists()) {
|
||||
await file.delete();
|
||||
}
|
||||
|
|
@ -164,7 +170,9 @@ class ProcessExecutor {
|
|||
workspace = workspace ?? Directory.systemTemp.path;
|
||||
var file = File('$workspace/$tempFileName');
|
||||
processData.file = file;
|
||||
print('Execute Shell: ${file.path} \n ${shell.toString()}');
|
||||
if(printStdout_) {
|
||||
print('Execute Shell: ${file.path} \n ${shell.toString()}');
|
||||
}
|
||||
if (await file.exists()) {
|
||||
await file.delete();
|
||||
}
|
||||
|
|
@ -193,8 +201,10 @@ class ProcessExecutor {
|
|||
var c = Completer<ProcessResult>();
|
||||
workspace = workspace ?? Directory.systemTemp.path;
|
||||
var file = File('$workspace/$tempFileName');
|
||||
print('---------------------------------------------------');
|
||||
print('Shell Path: ${file.path} \nExecute Shell: ${shell.toString()}');
|
||||
if(printStdout) {
|
||||
print('---------------------------------------------------');
|
||||
print('Shell Path: ${file.path} \nExecute Shell: ${shell.toString()}');
|
||||
}
|
||||
ProcessResult? processResult;
|
||||
if (Platform.isMacOS || Platform.isLinux) {
|
||||
file.createSync();
|
||||
|
|
|
|||
Loading…
Reference in a new issue