Skip to content

process.stdin never delivers piped input and process.argv does not contain script arguments #49

Closed

Description

@hassidan

Test I ran

printf 'l1\nl2\n' | node stdin.ts
printf 'l1\nl2\n' | slice run stdin.ts

node argv.ts a b
slice run argv.ts a b
slice run argv.ts -- a b

stdin.ts

let data = "";
process.stdin.setEncoding("utf8");
process.stdin.on("data", (c) => { data += c; });
process.stdin.on("end", () => { console.log("stdin bytes=" + data.length + " content=" + JSON.stringify(data)); });
setTimeout(() => console.log("after 300ms: bytes so far=" + data.length), 300);

argv.ts

console.log(JSON.stringify({ argvLength: process.argv.length, tail: process.argv.slice(2) }));

Result

stdin.ts   node : stdin bytes=6 content="l1\nl2\n"
           slice: stdin bytes=0 content=""

argv.ts    node            : {"argvLength":4,"tail":["a","b"]}
           slice run … a b : {"argvLength":1,"tail":[]}
           slice run … -- a b : {"argvLength":1,"tail":[]}

node:readline over process.stdin (for await (const line of rl)) likewise yields no lines, while the same interface over Readable.from([...]) works.

What is wrong

  • Data piped to the process is never emitted on process.stdin ('data' does not fire; 'end' fires immediately with nothing).
  • process.argv has length 1; neither the script path nor arguments after it are present, and I found no CLI syntax that forwards them.

COMPATIBILITY.md lists process.stdin and process.argv as supported. If stdin and argv are intentionally withheld from the isolate, an explicit capability (and a note in the matrix) would make that clear; today the script just sees empty input.

Environment

  • Slice v0.10.7, commit ea7c70c, built with cargo +1.96.0 build --release --locked --bin slice
  • Reference: Node.js v24.22.2 (same script, same machine)
  • Ubuntu 26.04, Linux 7.0, x86_64
  • Not checked on v0.10.5.

Activity

  1. siktec-lab commented on Nov 11, 2026

    @siktec-lab
    Collaborator

    Fixed in PR #65 (v0.10.9):

    • Added -e / --eval and -p / --print inline script execution.
    • Added -c / --check (slice check) syntax and TypeScript validation without execution.
    • Added -v / -V / --version flags and stdin script execution (slice - and piped stdin).
    • Populated process.argv ([execPath, scriptPath, ...scriptArgs]) and propagated non-zero exit codes to the OS.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions