shellInfo top-level property
String?
get
shellInfo
General Library Documentation Undocument By General Corporation & Global Corporation & General Developer
Implementation
String? get shellInfo {
if (Dart.isAndroid) {
return "terminal";
}
String shellPath = Platform.environment["SHELL"] ?? "";
final String shell = shellPath.split("/").last.trim();
String version = "";
switch (shell) {
case "zsh":
version = (Process.runSync(shellPath, ["--version"]))
.stdout
.toString()
.split(" ")[1]
.trim();
break;
default:
try {
version = (Process.runSync(shellPath, ["--version"]))
.stdout
.toString()
.split(" ")[1]
.trim();
} catch (e) {}
break;
}
return "${shell} ${version}".trim();
}