mirror of
https://github.com/wownero/cyberwow.git
synced 2026-12-03 13:43:59 +01:00
generalize run type
This commit is contained in:
@@ -30,13 +30,14 @@ import '../helper.dart';
|
||||
import '../../config.dart' as config;
|
||||
import '../../logging.dart';
|
||||
|
||||
typedef IsExitingFunc = bool Function();
|
||||
typedef ShouldExit = bool Function();
|
||||
|
||||
Stream<String> runBinary
|
||||
(
|
||||
final String name,
|
||||
final IsExitingFunc isExiting,
|
||||
{final Stream<String> input}
|
||||
{ final Stream<String> input,
|
||||
final ShouldExit shouldExit,
|
||||
}
|
||||
) async* {
|
||||
final newPath = await getBinaryPath(name);
|
||||
|
||||
@@ -85,9 +86,11 @@ Stream<String> runBinary
|
||||
|
||||
if (config.isEmu) return;
|
||||
|
||||
if (!isExiting()) {
|
||||
log.warning('process is ded');
|
||||
exit(1);
|
||||
if (shouldExit != null) {
|
||||
if (!shouldExit()) {
|
||||
log.warning('process is ded');
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
log.info('Daemon exited gracefully.');
|
||||
|
||||
@@ -130,7 +130,7 @@ class _CyberWOW_PageState extends State<CyberWOW_Page> with WidgetsBindingObserv
|
||||
SyncingState _syncingState = await _loadingState.next(loading, '');
|
||||
|
||||
final syncing = process
|
||||
.runBinary(binName, _isExiting, input: inputStreamController.stream)
|
||||
.runBinary(binName, input: inputStreamController.stream, shouldExit: _isExiting)
|
||||
.asBroadcastStream();
|
||||
|
||||
HookedState _syncedNextState = await _syncingState.next(inputStreamController.sink, syncing);
|
||||
|
||||
Reference in New Issue
Block a user