parent
555aec4934
commit
7124b6fc35
|
|
@ -58,15 +58,18 @@ class _ManagerState extends State<Manager> {
|
||||||
}
|
}
|
||||||
|
|
||||||
VmInfo _parseVmInfo(name) {
|
VmInfo _parseVmInfo(name) {
|
||||||
String shellScript = File(name + '/' + name + '.sh').readAsStringSync();
|
|
||||||
RegExpMatch? sshMatch = RegExp('hostfwd=tcp::(\\d+?)-:22').firstMatch(shellScript);
|
|
||||||
RegExpMatch? spiceMatch = RegExp('-spice.+?port=(\\d+)').firstMatch(shellScript);
|
|
||||||
VmInfo info = VmInfo();
|
VmInfo info = VmInfo();
|
||||||
if (sshMatch != null) {
|
List<String> lines = File(name + '/' + name + '.ports').readAsLinesSync();
|
||||||
info.sshPort = sshMatch.group(1);
|
for (var line in lines) {
|
||||||
}
|
List<String> parts = line.split(',');
|
||||||
if (spiceMatch != null) {
|
switch(parts[0]) {
|
||||||
info.spicePort = spiceMatch.group(1);
|
case 'ssh':
|
||||||
|
info.sshPort = parts[1];
|
||||||
|
break;
|
||||||
|
case 'spice':
|
||||||
|
info.spicePort = parts[1];
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue