fix & opt

- display when client.run no result
- remove dep. marquee
This commit is contained in:
Junyuan Feng
2022-05-24 13:25:44 +08:00
parent cb5aed8e79
commit 64196a7ba6
12 changed files with 40 additions and 42 deletions

View File

@@ -89,7 +89,8 @@ class AptProvider extends BusyProvider {
default:
// avoid other outputs
// such as: [Could not chdir to home directory /home/test: No such file or directory, , WARNING: apt does not have a stable CLI interface. Use with caution in scripts., , Listing...]
final idx = list.indexWhere((element) => element.contains('[upgradable from:'));
final idx =
list.indexWhere((element) => element.contains('[upgradable from:'));
if (idx != -1) {
list = list.sublist(idx);
}

View File

@@ -176,7 +176,12 @@ class ServerProvider extends BusyProvider {
logger.info(
'Connected to [${spi.name}] in [${time2.difference(time1).toString()}].');
s.connectionState = ServerConnectionState.connected;
s.client!.run("echo '$shellCmd' > $shellPath && chmod +x $shellPath");
final writeResult = await s.client!
.run("echo '$shellCmd' > $shellPath && chmod +x $shellPath")
.string;
if (writeResult.isNotEmpty) {
throw Exception(writeResult);
}
} catch (e) {
s.connectionState = ServerConnectionState.failed;
s.status.failedInfo = '$e ## ';
@@ -189,13 +194,15 @@ class ServerProvider extends BusyProvider {
// if client is null, return
if (s.client == null) return;
final raw = await s.client!.run("sh $shellPath").string;
if (raw.isEmpty) {
final lines = raw.split(seperator).map((e) => e.trim()).toList();
if (raw.isEmpty || lines.length == 1) {
s.connectionState = ServerConnectionState.failed;
s.status.failedInfo = 'Empty output';
if (s.status.failedInfo == null || s.status.failedInfo!.isEmpty) {
s.status.failedInfo = 'No data received';
}
notifyListeners();
return;
}
final lines = raw.split(seperator).map((e) => e.trim()).toList();
lines.removeAt(0);
try {

View File

@@ -2,9 +2,9 @@
class BuildData {
static const String name = "ServerBox";
static const int build = 143;
static const int build = 144;
static const String engine =
"Flutter 3.0.1 • channel stable • https://github.com/flutter/flutter.git\nFramework • revision fb57da5f94 (3 days ago) • 2022-05-19 15:50:29 -0700\nEngine • revision caaafc5604\nTools • Dart 2.17.1 • DevTools 2.12.2\n";
static const String buildAt = "2022-05-23 17:48:09.246927";
static const int modifications = 0;
"Flutter 3.0.1 • channel stable • https://github.com/flutter/flutter.git\nFramework • revision fb57da5f94 (4 days ago) • 2022-05-19 15:50:29 -0700\nEngine • revision caaafc5604\nTools • Dart 2.17.1 • DevTools 2.12.2\n";
static const String buildAt = "2022-05-24 13:07:20.629833";
static const int modifications = 2;
}