observablehq / framework

A static site generator for data apps, dashboards, reports, and more. Observable Framework combines JavaScript on the front-end for interactive graphics with any language on the back-end for data analysis.
https://observablehq.com/framework/
ISC License
2.13k stars 85 forks source link

`observable deploy` prompts for message in non-interactive shell, throws ERR_TTY_INIT_FAILED #1432

Closed mootari closed 3 weeks ago

mootari commented 3 weeks ago

Running observable deploy without the --message param prompts the user for a deploy message. The prompt is created even when effects.isTty is false, causing the process to error with

■  Error: TTY initialization failed: uv_tty_init returned EINVAL (invalid argument)
│
└  The full error follows

node:internal/errors:563
    ErrorCaptureStackTrace(err);
    ^

SystemError [ERR_TTY_INIT_FAILED]: TTY initialization failed: uv_tty_init returned EINVAL (invalid argument)
    at new SystemError (node:internal/errors:259:5)
    at new NodeError (node:internal/errors:370:7)
    at new WriteStream (node:tty:93:11)
    at TD.prompt (file:/// ... /node_modules/@clack/core/dist/index.mjs:9:818)
    at Module.te (file:/// ... /node_modules/@clack/prompts/dist/index.mjs:9:7)
    at Module.deploy (file:/// ... /node_modules/@observablehq/framework/dist/deploy.js:238:32)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async file:/// ... /node_modules/@observablehq/framework/dist/bin/observable.js:112:7 {
  code: 'ERR_TTY_INIT_FAILED',
  info: {
    errno: -22,
    code: 'EINVAL',
    message: 'invalid argument',
    syscall: 'uv_tty_init'
  },
  errno: [Getter/Setter],
  syscall: [Getter/Setter]
}

To reproduce, run the command with stdin closed:

observable deploy --debug <&-