@ai-ecoverse/slicc-kernel 1.8.9 → 1.8.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -993,7 +993,7 @@ function ptyStat(path) {
993
993
  function nonblocking(stream) {
994
994
  return (stream.flags & O_NONBLOCK) !== 0 ? { nonblock: true } : void 0;
995
995
  }
996
- var POLLIN, POLLOUT, POLLERR, POLLHUP, POLLRDNORM, POLLWRNORM, O_NONBLOCK, SOCKET_MODE, PTY_PATH, O_CREAT, O_EXCL, O_NOCTTY, O_TRUNC, KILLED_BY_SIGPIPE, ProcessExit, SyscallError, KernelStreams;
996
+ var POLLIN, POLLOUT, POLLERR, POLLHUP, POLLRDNORM, POLLWRNORM, O_NONBLOCK, SOCKET_MODE, PTY_PATH, TTY_PATH, O_CREAT, O_EXCL, O_NOCTTY, O_TRUNC, KILLED_BY_SIGPIPE, ProcessExit, SyscallError, KernelStreams;
997
997
  var init_kernel_streams = __esm({
998
998
  "src/process/kernel-streams.ts"() {
999
999
  "use strict";
@@ -1007,6 +1007,7 @@ var init_kernel_streams = __esm({
1007
1007
  O_NONBLOCK = 2048;
1008
1008
  SOCKET_MODE = 49663;
1009
1009
  PTY_PATH = /^\/dev\/(?:ptmx|pts\/(\d+))$/;
1010
+ TTY_PATH = /^\/dev\/tty\d+$/;
1010
1011
  O_CREAT = 64;
1011
1012
  O_EXCL = 128;
1012
1013
  O_NOCTTY = 256;
@@ -1074,9 +1075,16 @@ var init_kernel_streams = __esm({
1074
1075
  }
1075
1076
  nameStream(stream, name) {
1076
1077
  stream.path = name;
1078
+ this.ttyNode(name);
1077
1079
  if (typeof this.Fs.stat !== "function") return;
1078
1080
  stream.stream_ops = { ...stream.stream_ops, getattr: () => this.Fs.stat?.(name) ?? {} };
1079
1081
  }
1082
+ ttyNode(name) {
1083
+ const { analyzePath, mkdev, makedev } = this.Fs;
1084
+ if (!TTY_PATH.test(name) || !analyzePath || !mkdev || !makedev) return;
1085
+ if (!analyzePath.call(this.Fs, name).exists)
1086
+ mkdev.call(this.Fs, name, makedev.call(this.Fs, 6, 0));
1087
+ }
1080
1088
  ttyOps(kfd) {
1081
1089
  return {
1082
1090
  ops: {