Skip to content
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

Unable to use prompts when stdin is a not a tty #290

Open
andrewthauer opened this issue Oct 30, 2024 · 0 comments
Open

Unable to use prompts when stdin is a not a tty #290

andrewthauer opened this issue Oct 30, 2024 · 0 comments

Comments

@andrewthauer
Copy link

andrewthauer commented Oct 30, 2024

I get the following error when when I try and use a dax interactive prompt when piping data to stdin.

error: Uncaught (in promise) Error: Cannot prompt when not a tty. (Prompt: 'Do you want to continue?')
    throw new Error(`Cannot prompt when not a tty. (Prompt: '${options.message}')`);

I realize this error is probably intentional, but I'm curious why this is not possible? I am able to pipe stdin data to other non deno process from deno itself. For example:

This works and allows fzf to be interactive

const input = 'hello world\nfoo'
const command = new Deno.Command('fzf', { stdin: 'piped', stdout: 'piped' });
const process = command.spawn();
const writer = process.stdin.getWriter();
writer.write(new TextEncoder().encode(input));
writer.releaseLock();
await process.stdin.close();
const result = await process.output();
onsole.log(new TextDecoder().decode(result.stdout))

I did some digging in the deno GH issues and found denoland/deno#23587 which seems like it might explain why. Can you confirm?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant