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:
+5
-5
@@ -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 };
|
||||
|
||||
Reference in New Issue
Block a user