diff --git a/cyberwow/lib/state.dart b/cyberwow/lib/state.dart index c9721d0..587dc1f 100644 --- a/cyberwow/lib/state.dart +++ b/cyberwow/lib/state.dart @@ -233,6 +233,7 @@ class SyncedState extends HookedState { int height; bool synced = true; + bool userExit = false; bool connected = true; Map getInfo = {}; List getConnections = []; @@ -250,6 +251,10 @@ class SyncedState extends HookedState { stdout.addLast('> ' + line + '\n'); syncState(); processInput.add(line); + + if (line == 'exit') { + userExit = true; + } } void append(final String msg) { @@ -281,7 +286,7 @@ class SyncedState extends HookedState { Future checkSync() async { await for (final _null in refresh.pull(getNotification, 'syncedState')) { - if (isExiting()) { + if (isExiting() || userExit) { log.fine('Synced state detected exiting'); break; } @@ -308,7 +313,7 @@ class SyncedState extends HookedState { await checkSync(); - if (isExiting()) { + if (isExiting() || userExit) { ExitingState _next = ExitingState ( setState, getNotification, isExiting, stdout, processOutput