메서드 호출 이슈 수정

This commit is contained in:
leedongmyung 2025-02-05 09:05:19 +09:00
parent 340e10ede6
commit 32a8fb5207
3 changed files with 19 additions and 19 deletions

View file

@ -13,7 +13,7 @@ class Application {
writeLog = (error, stack) => logError('$error:\n$stack');
func();
}, (error, stack) {
writeLog??(error, stack);
writeLog?.call(error, stack);
errorListener(error, stack);
});
}

View file

@ -161,13 +161,13 @@ class ProcessExecutor {
if (Platform.isMacOS || Platform.isWindows) {
workspace = workspace ?? Directory.systemTemp.path;
if (printStdout_) {
logHandler ?? ('Execute Shell: $arg', LogType.verbose);
logHandler?.call('Execute Shell: $arg', LogType.verbose);
}
try {
processData.process =
await Process.start(exe, args, workingDirectory: workspace);
} on Exception catch (e) {
logHandler ?? (e, LogType.error);
logHandler?.call(e.toString(), LogType.error);
}
} else {
logHandler ?? ('This platform not support process executor.');
@ -192,7 +192,7 @@ class ProcessExecutor {
var file = File('$workspace/$tempFileName');
processData.file = file;
if (printStdout_) {
logHandler ??
logHandler?.call
(
'Execute Shell: ${file.path} \n ${shell.toString()}',
LogType.verbose
@ -208,14 +208,14 @@ class ProcessExecutor {
processData.process = await Process.start(shellExe, [file.path],
workingDirectory: workspace);
} on Exception catch (e) {
logHandler ?? (e, LogType.error);
logHandler?.call(e.toString(), LogType.error);
}
} else if (Platform.isWindows) {
workspace = workspace ?? Directory.systemTemp.path;
var file = File('$workspace/$tempFileName');
processData.file = file;
if (printStdout_) {
logHandler ??
logHandler?.call
(
'Execute Shell: ${file.path} \n ${shell.toString()}',
LogType.verbose
@ -232,16 +232,16 @@ class ProcessExecutor {
processData.process = await Process.start(
'powershell', ['-NoProfile', '-File', file.absolute.path]);
} on Exception catch (e) {
logHandler ?? (e, LogType.error);
logHandler?.call(e.toString(), LogType.error);
}
} else {
logHandler ??
logHandler?.call
('This platform not support process executor.', LogType.error);
}
c.complete(processData);
await processData.waitForExit();
} on Exception catch (e) {
logHandler ??
logHandler?.call
('General Exception in ProcessExecutor.start: $e', LogType.error);
}
return c.future;
@ -257,12 +257,12 @@ class ProcessExecutor {
workspace = workspace ?? Directory.systemTemp.path;
var file = File('$workspace/$tempFileName');
if (printStdout) {
logHandler ??
logHandler?.call
(
'---------------------------------------------------',
LogType.verbose
);
logHandler ??
logHandler?.call
(
'Shell Path: ${file.path} \nExecute Shell: ${shell.toString()}',
LogType.verbose
@ -277,7 +277,7 @@ class ProcessExecutor {
processResult = await Process.run(shellExe, [file.path],
workingDirectory: workspace);
} on Exception catch (e) {
logHandler ?? (e, LogType.error);
logHandler?.call(e.toString(), LogType.error);
} finally {
file.deleteSync();
}
@ -298,7 +298,7 @@ class ProcessExecutor {
file.deleteSync();
c.complete(processResult);
} else {
logHandler ??
logHandler?.call
('This platform not support process executor.', LogType.error);
c.complete(null);
}
@ -308,7 +308,7 @@ class ProcessExecutor {
if (decoder != null) {
stdout = decoder.convert(stdout.codeUnits);
}
logHandler ??
logHandler?.call
(
// ignore: prefer_interpolation_to_compose_strings
'[ProcessExecutor] Result: $stdout',
@ -320,7 +320,7 @@ class ProcessExecutor {
if (decoder != null) {
stderr = decoder.convert(stderr.codeUnits);
}
logHandler ??
logHandler?.call
(
// ignore: prefer_interpolation_to_compose_strings
'[ProcessExecutor] Exit Code: ${processResult.exitCode}\nError: $stderr',

View file

@ -28,11 +28,11 @@ class SocketClient {
} catch (e) {
print(e);
}
resultListener??(connected);
resultListener?.call(connected);
// ignore: argument_type_not_assignable_to_error_handler
}).catchError((AsyncError e) {
print('Unable to connect: $e');
resultListener??(connected);
resultListener?.call(connected);
});
}
@ -52,7 +52,7 @@ class SocketClient {
}
void disconnect() {
eventDisconnected??();
eventDisconnected?.call();
_socket!.close();
_socket = null;
}
@ -111,6 +111,6 @@ class SocketClient {
void _onDone() {
print('Disconnected');
eventDisconnected??();
eventDisconnected?.call();
}
}