fix SSHClient.exec

This commit is contained in:
lollipopkit
2022-12-11 14:08:08 +08:00
parent d43d251d92
commit 78b46998d1
10 changed files with 57 additions and 45 deletions

View File

@@ -99,7 +99,7 @@ class AptProvider extends BusyProvider {
onStdout: (data, sink) {
updateLog = (updateLog ?? '') + data;
notifyListeners();
onUpdate!();
if (onUpdate != null) onUpdate!();
},
);
return await client
@@ -120,13 +120,13 @@ class AptProvider extends BusyProvider {
await client!.exec(
_wrap(upgradeCmd),
onStderr: (data, sink) => _onPwd(data, sink),
onStderr: _onPwd,
onStdout: (log, sink) {
if (lastLog == log.trim()) return;
upgradeLog = (upgradeLog ?? '') + log;
lastLog = log.trim();
notifyListeners();
onUpgrade!();
if (onUpgrade != null) onUpgrade!();
},
);

View File

@@ -30,7 +30,6 @@ class DockerProvider extends BusyProvider {
DockerErr? error;
PwdRequestFunc? onPwdReq;
String? hostId;
String? runLog;
bool isRequestingPwd = false;
void init(SSHClient client, String userName, PwdRequestFunc onPwdReq,
@@ -44,7 +43,7 @@ class DockerProvider extends BusyProvider {
void clear() {
client = userName = error = items = version = edition = onPwdReq = null;
isRequestingPwd = false;
hostId = runLog = null;
hostId = null;
}
Future<void> refresh() async {
@@ -124,14 +123,8 @@ class DockerProvider extends BusyProvider {
final code = await client!.exec(
_wrapHost(cmd),
onStderr: _onPwd,
onStdout: (data, _) {
runLog = '$runLog$data';
notifyListeners();
},
);
runLog = null;
if (code != 0) {
setBusyState(false);
return DockerErr(type: DockerErrType.unknown, message: errs.join('\n'));

View File

@@ -2,9 +2,9 @@
class BuildData {
static const String name = "ServerBox";
static const int build = 166;
static const int build = 169;
static const String engine =
"Flutter 3.3.9 • channel stable • https://github.com/flutter/flutter.git\nFramework • revision b8f7f1f986 (12 days ago) • 2022-11-23 06:43:51 +0900\nEngine • revision 8f2221fbef\nTools • Dart 2.18.5 • DevTools 2.15.0\n";
static const String buildAt = "2022-12-04 21:57:10.591121";
static const int modifications = 2;
"Flutter 3.3.9 • channel stable • https://github.com/flutter/flutter.git\nFramework • revision b8f7f1f986 (3 weeks ago) • 2022-11-23 06:43:51 +0900\nEngine • revision 8f2221fbef\nTools • Dart 2.18.5 • DevTools 2.15.0\n";
static const String buildAt = "2022-12-11 12:36:17.737879";
static const int modifications = 8;
}