diff --git a/.gitignore b/.gitignore index a2b5be1..00ed0f8 100644 --- a/.gitignore +++ b/.gitignore @@ -185,6 +185,7 @@ $RECYCLE.BIN/ /target Cargo.lock +.cargo/ .pnp.* .yarn/* diff --git a/.replit b/.replit new file mode 100644 index 0000000..7ce2db0 --- /dev/null +++ b/.replit @@ -0,0 +1,17 @@ +run = "bun run build:debug && bun test" +modules = ["bun-1.0:v17-20240117-0bd73cd", "nodejs-20:v24-20240117-0bd73cd", "rust-stable:v4-20240117-0bd73cd"] + +disableGuessImports = true +disableInstallBeforeRun = true + +[nix] +channel = "stable-23_11" + +[rules] + +[rules.formatter] + +[rules.formatter.fileExtensions] + +[rules.formatter.fileExtensions.".ts"] +id = "module:nodejs-20:v24-20240117-0bd73cd/formatter:prettier" diff --git a/bun.lockb b/bun.lockb index 00f7cc9..488a467 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/index.js b/index.js index a63da8c..1481fc1 100644 --- a/index.js +++ b/index.js @@ -266,6 +266,20 @@ switch (platform) { } } break + case 's390x': + localFileExisted = existsSync( + join(__dirname, 'ruspty.linux-s390x-gnu.node') + ) + try { + if (localFileExisted) { + nativeBinding = require('./ruspty.linux-s390x-gnu.node') + } else { + nativeBinding = require('@replit/ruspty-linux-s390x-gnu') + } + } catch (e) { + loadError = e + } + break default: throw new Error(`Unsupported architecture on Linux: ${arch}`) } diff --git a/index.test.ts b/index.test.ts index e32a484..26fb335 100644 --- a/index.test.ts +++ b/index.test.ts @@ -17,7 +17,7 @@ describe("PTY", () => { expect(err).toBeNull(); expect(exitCode).toBe(0); done(); - } + }, ); const readStream = fs.createReadStream("", { fd: pty.fd }); @@ -38,7 +38,7 @@ describe("PTY", () => { expect(err).toBeNull(); expect(exitCode).toBe(17); done(); - } + }, ); }); @@ -85,19 +85,12 @@ describe("PTY", () => { writeStream.write("stty size; echo 'done1'\n"); }); - test.skip("respects working directory", (done) => { - const pty = new Pty( - "/bin/pwd", - [], - {}, - CWD, - [80, 24], - (err, exitCode) => { - expect(err).toBeNull(); - expect(exitCode).toBe(0); - done(); - } - ); + test("respects working directory", (done) => { + const pty = new Pty("/bin/pwd", [], {}, CWD, [80, 24], (err, exitCode) => { + expect(err).toBeNull(); + expect(exitCode).toBe(0); + done(); + }); const readStream = fs.createReadStream("", { fd: pty.fd }); @@ -112,7 +105,7 @@ describe("PTY", () => { const pty = new Pty( "/bin/sh", - ["-c", "echo $ENV_VARIABLE; exit"], + ["-c", "sleep 0.1s && echo $ENV_VARIABLE; exit"], { ENV_VARIABLE: message, }, @@ -122,8 +115,9 @@ describe("PTY", () => { expect(err).toBeNull(); expect(exitCode).toBe(0); expect(buffer).toBe(message + "\r\n"); + done(); - } + }, ); const readStream = fs.createReadStream("", { fd: pty.fd }); diff --git a/replit.nix b/replit.nix new file mode 100644 index 0000000..66babba --- /dev/null +++ b/replit.nix @@ -0,0 +1,3 @@ +{ pkgs }: { + deps = []; +} \ No newline at end of file