Released 9.2.5

This commit is contained in:
Alessandro Autiero
2024-08-18 20:29:09 +02:00
parent 582270849e
commit 4c3fe9bc65
21 changed files with 503 additions and 383 deletions

View File

@@ -15,13 +15,16 @@ final Semaphore _semaphore = Semaphore();
String? _lastIp;
String? _lastPort;
Future<Process> startEmbeddedBackend(bool detached) async {
Future<Process> startEmbeddedBackend(bool detached, {void Function(String)? onError}) async {
final process = await startProcess(
executable: backendStartExecutable,
window: detached,
);
process.stdOutput.listen((message) => log("[BACKEND] Message: $message"));
process.stdError.listen((error) => log("[BACKEND] Error: $error"));
process.stdError.listen((error) {
log("[BACKEND] Error: $error");
onError?.call(error);
});
process.exitCode.then((exitCode) => log("[BACKEND] Exit code: $exitCode"));
return process;
}

View File

@@ -102,8 +102,7 @@ Future<bool> startElevatedProcess({required String executable, required String a
shellInput.ref.fMask = ES_AWAYMODE_REQUIRED;
shellInput.ref.lpVerb = "runas".toNativeUtf16();
shellInput.ref.cbSize = sizeOf<SHELLEXECUTEINFO>();
var shellResult = ShellExecuteEx(shellInput);
return shellResult == 1;
return ShellExecuteEx(shellInput) == 1;
}
Future<Process> startProcess({required File executable, List<String>? args, bool useTempBatch = true, bool window = false, String? name, Map<String, String>? environment}) async {
@@ -313,7 +312,14 @@ final class _ExtendedProcess implements Process {
@override
Future<int> get exitCode => _delegate.exitCode;
Future<int> get exitCode {
try {
return _delegate.exitCode;
}catch(_) {
return watchProcess(_delegate.pid)
.then((_) => -1);
}
}
@override
bool kill([ProcessSignal signal = ProcessSignal.sigterm]) => _delegate.kill(signal);