-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prisma CLI non-interactive detection is incorrect. #14620
Comments
Recording some notes for future Googlers... Okay so I figured out the code for It turns out Unfortunately I'm stuck on older version of const child = require("child_process").spawn(command, {
cwd: process.cwd(),
shell: "bash",
// Tells the child process to receive the same stdin/stdout/stderr as the parent
// https://nodejs.org/api/child_process.html#optionsstdio
stdio: ["inherit", "inherit", "inherit"],
windowsHide: true,
}); So I've found a workaround, but having the child process inherit the parent causes other minor issues with It also surprises me to check But also I really don't understand the in's and out's of processes and child processes. I looked through the history of the repo and didn't see a design justification for using |
Thanks @AndrewSouthpaw for all the work, I'm reviewing this now. About
https://nodejs.org/docs/latest-v14.x/api/tty.html
So what's the difference between
The library we use
Checking the codebase, why do we use
Notes: Testing
|
Note: random find in Inquirer.js // Inquirer 8.x:
// opt.skipTTYChecks = opt.skipTTYChecks === undefined ? opt.input !== undefined : opt.skipTTYChecks;
opt.skipTTYChecks = opt.skipTTYChecks === undefined ? true : opt.skipTTYChecks;
// Default `input` to stdin
const input = opt.input || process.stdin;
// Check if prompt is being called in TTY environment
// If it isn't return a failed promise
if (!opt.skipTTYChecks && !input.isTTY) {
const nonTtyError = new Error(
'Prompts can not be meaningfully rendered in non-TTY environments'
);
nonTtyError.isTtyError = true;
throw nonTtyError;
} |
Bug description
The
prisma migrate
CLI command guards against use in non-interactive environments, but it can lead to false positives.How to reproduce
Run
prisma migrate
from a CLI helper tool likeoclif
usingzx
to execute the command. It is capable of receiving input, but Prisma thinks it's non-interactive.Expected behavior
prisma migrate
doesn't error with the non-interactive error.Prisma information
Not relevant, applies to any schema
Environment & setup
n/a
Prisma Version
The text was updated successfully, but these errors were encountered: