Shell update

- changed shell init code to synchronous with guaranteed returns
- Shell.Instance now a normal method not a getter
This commit is contained in:
2026-09-03 11:45:19 +02:00
parent 8a349330b0
commit 2715e5e28e
2 changed files with 20 additions and 24 deletions
+5 -5
View File
@@ -46,14 +46,14 @@ users.set(1000, user);
groups.set(1000, group);
const state: ShellState = createInitialShellState(fs, users, groups, user);
await Shell.init(state);
Shell.init(state);
//console.log(resolveInode(Shell.Instance?.State!, 6));
//console.log(resolveInode(Shell.Instance?.State!, 6, true));
//console.log(sortTreeNodes(Shell.Instance?.State!, dnTraverseTree(Shell.Instance?.State.filesystem!, 0)));
Shell.Instance?.on("result", payload => {
Shell.Instance().on("result", payload => {
const decoded = new TextDecoder().decode(payload.result.stdout.toArray());
process.stdout.write(decoded + "\n");
process.stdout.write(resolveInodeToHome(payload.state, getCurrentSession(payload.state).cwd) + "\n> ");
@@ -73,13 +73,13 @@ Shell.Instance?.on("result", payload => {
//console.clear();
process.stdout.write(resolveInodeToHome(state, getCurrentSession(state).cwd) + "\n> ");
process.stdin.on("data", async data => {
if (Shell.Instance?.BoundPID !== null) {
Shell.Instance?.sendInput(data.toString().trim());
if (Shell.Instance().BoundPID !== null) {
Shell.Instance().sendInput(data.toString().trim());
return;
}
const input = data.toString().trim();
await Shell.Instance?.execute(input);
await Shell.Instance().execute(input);
});
//export { Termos };