- fixed a bug in dnTaverseTree where children would get pushed into the result in reverse order

- added an inode display to the `printTree` algorithm

- removed a redundant type in *`signal.ts`*
- improved `resolveInode` to now take `ShellState` instead of `FileSystem` and added an optional `abs` *`boolean`* argument to determine if the retuned path should be normalized or absolute

- implemented a builtin `TreeNode` quicksort function
- changed the `TreeNodeType` to a numeric enum
- added a standalone `Posix` class that holds a const with character weights compliant with posix
This commit is contained in:
2026-08-25 06:34:23 +02:00
parent dad18cd4cc
commit 20718604e4
9 changed files with 294 additions and 30 deletions
+9 -6
View File
@@ -33,14 +33,14 @@ const groups: Map<number, GroupInfo> = new Map();
const user: UserInfo = {
username: "root",
uid: 1000,
gid: 0,
group: [1000],
home: 0,
gid: 1000, // <- PRIMARY GID
group: [1000], // <- GROUPS ARRAY
home: 3,
};
const group: GroupInfo = {
groupname: "root",
gid: 1000,
members: [0],
members: [1000], // <- UID
};
users.set(1000, user);
groups.set(1000, group);
@@ -48,10 +48,13 @@ groups.set(1000, group);
const state: ShellState = createInitialShellState(fs, users, groups, user);
await Shell.init(state);
console.log(resolveInode(Shell.Instance?.State!, 6));
console.log(resolveInode(Shell.Instance?.State!, 6, true));
Shell.Instance?.on("result", payload => {
const decoded = new TextDecoder().decode(payload.result.stdout.toArray());
process.stdout.write(decoded + "\n");
process.stdout.write(resolveInode(payload.state.filesystem, getCurrentSession(payload.state).cwd) + "\n> ");
process.stdout.write(resolveInode(payload.state, getCurrentSession(payload.state).cwd) + "\n> ");
});
/*
@@ -66,7 +69,7 @@ Shell.Instance?.on("result", payload => {
}); */
//console.clear();
process.stdout.write(resolveInode(Shell.Instance?.State.filesystem!, getCurrentSession(state).cwd) + "\n> ");
process.stdout.write(resolveInode(Shell.Instance?.State!, getCurrentSession(state).cwd) + "\n> ");
process.stdin.on("data", async data => {
if (Shell.Instance?.BoundPID !== null) {
Shell.Instance?.sendInput(data.toString().trim());