mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2026-01-30 12:54:30 +01:00
fix(ssh): Modify the return type of execWithPwd to include the output content
Adjust the return type of the `execWithPwd` method to `(int?, String)` so that it can simultaneously return the exit code and output content Fix the issue in ContainerNotifier where the return result of execWithPwd is not handled correctly Ensure that server operations (shutdown/restart/suspend) are correctly pending until the command execution is completed
This commit is contained in:
@@ -112,7 +112,7 @@ extension SSHClientX on SSHClient {
|
||||
return (session, result.takeBytes().string);
|
||||
}
|
||||
|
||||
Future<int?> execWithPwd(
|
||||
Future<(int?, String)> execWithPwd(
|
||||
String script, {
|
||||
String? entry,
|
||||
BuildContext? context,
|
||||
@@ -121,7 +121,7 @@ extension SSHClientX on SSHClient {
|
||||
required String id,
|
||||
}) async {
|
||||
var isRequestingPwd = false;
|
||||
final (session, _) = await exec(
|
||||
final (session, output) = await exec(
|
||||
(sess) {
|
||||
sess.stdin.add('$script\n'.uint8List);
|
||||
sess.stdin.close();
|
||||
@@ -147,7 +147,7 @@ extension SSHClientX on SSHClient {
|
||||
onStdout: onStdout,
|
||||
entry: entry,
|
||||
);
|
||||
return session.exitCode;
|
||||
return (session.exitCode, output);
|
||||
}
|
||||
|
||||
Future<String> execForOutput(
|
||||
|
||||
Reference in New Issue
Block a user