'Can't answer a question unless a user TTY'
yarn version: 1.15.2 node version: 10.15.1 OS: Win10/Fedora 29
What is the current behavior? When i try to spawn a subprocess in node via child_process i got error 'Can't answer a question unless a user TTY'. It Only happens in case of package version conflicts and user inpute expected.
If the current behavior is a bug, please provide the steps to reproduce. Example code:
const spawn = require("child_process").spawn;
const express = require("express");
const app = express();
const expressWs = require("express-ws")(app);
app.use(express.static(${__dirname}));
expressWs.app.ws("/shell", ws => {
const shell = spawn("yarn.cmd", ["add", "pkgName"], { stdio: ["pipe", "pipe", "pipe"] });
shell.stdout.on("data", data => { ws.send(data.toString()); });
shell.stderr.on("data", data => { ws.send(data.toString()); });
ws.on("message", msg => { shell.stdin.write(msg); }); });
app.listen(3000);
Temporal solution for me was to comment lines in ConsoleReporter
if (!process.stdout.isTTY) {
return (_promise || _load_promise()).default.reject(new Error("Can't answer a question unless a user TTY"));
}Source: yarnpkg/yarn