mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2025-12-17 23:34:24 +01:00
fix: bad check of script writing result (#275)
This commit is contained in:
@@ -69,9 +69,6 @@ class ContainerProvider extends ChangeNotifier {
|
||||
return false;
|
||||
}
|
||||
|
||||
/// Docker Logic:
|
||||
/// - Check if docker is installed, if not, return error, if yes, continue
|
||||
/// - Check permission, if permission denied and no DOCKER_HOST, return error
|
||||
Future<void> refresh() async {
|
||||
var raw = '';
|
||||
|
||||
|
||||
@@ -259,25 +259,30 @@ class ServerProvider extends ChangeNotifier {
|
||||
}
|
||||
|
||||
Future<void> _writeInstallerScript(Server s) async {
|
||||
void ensure(String? writeResult) {
|
||||
if (writeResult == null || writeResult.isNotEmpty) {
|
||||
throw Exception("Failed to write installer script: $writeResult");
|
||||
}
|
||||
}
|
||||
/// TODO: Find a better way to judge if the write is successful
|
||||
|
||||
// Issues #275
|
||||
// Can't use writeResult to judge if the write is successful
|
||||
|
||||
// void ensure(String? writeResult) {
|
||||
// if (writeResult == null || writeResult.isNotEmpty) {
|
||||
// throw Exception("Failed to write installer script: $writeResult");
|
||||
// }
|
||||
// }
|
||||
|
||||
final client = s.client;
|
||||
if (client == null) {
|
||||
throw Exception("Invalid state: s.client cannot be null");
|
||||
}
|
||||
|
||||
ensure(await client.run(ShellFunc.installerMkdirs).string);
|
||||
await client.run(ShellFunc.installerMkdirs).string;
|
||||
|
||||
ensure(await client.runForOutput(ShellFunc.installerShellWriter,
|
||||
await client.runForOutput(ShellFunc.installerShellWriter,
|
||||
action: (session) async {
|
||||
session.stdin.add(ShellFunc.allScript.uint8List);
|
||||
}).string);
|
||||
}).string;
|
||||
|
||||
ensure(await client.run(ShellFunc.installerPermissionModifier).string);
|
||||
await client.run(ShellFunc.installerPermissionModifier).string;
|
||||
}
|
||||
|
||||
Future<void> _getData(ServerPrivateInfo spi) async {
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
class BuildData {
|
||||
static const String name = "ServerBox";
|
||||
static const int build = 762;
|
||||
static const int build = 763;
|
||||
static const String engine = "3.19.0";
|
||||
static const String buildAt = "2024-02-18 15:57:42";
|
||||
static const int modifications = 12;
|
||||
static const String buildAt = "2024-02-18 17:23:32";
|
||||
static const int modifications = 5;
|
||||
static const int script = 38;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user