Skip to content

Piping data via STDIN into executable makes text prompts not work #76

Open
@cchexcode

Description

@cchexcode

Issue
As soon as I populate the STDIN pipe to my program with any data, the text prompts won't work properly.

Context
I have a binary that does text processing (https://github.com/replicadse/complate).
In the past, the configuration for the template was loaded via a configuration file. I have added a feature with which one should be able to pipe the configuration string directly into the print command.

Behaviour

dialoguer::Input::new().allow_empty(false).with_prompt("some text").interact()

When specifying allow_empty(false), the terminal flickers and shows weird behaviour. I can not enter text nor can I do anything else than Ctrl+C exit.
When specifying allow_empty(true), the data result string is empty.

References
Here you can see me reading the data from STDIN:
https://github.com/replicadse/complate/pull/10/files#diff-c5354523dab7ee14c84278715c952cb7e302af46f5c8372b94375b36f003b93eR138
Here you can see me using dialoguer:
https://github.com/replicadse/complate/blob/master/src/render/mod.rs#L174

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions