click-contrib / click-repl

Subcommand REPL for click apps
MIT License
215 stars 41 forks source link

Prompt character not shown via SSH #31

Closed rcarmo closed 6 years ago

rcarmo commented 7 years ago

I'm doing a (simple) restricted shell around this (more for convenience than security's sake), and the prompt character doesn't show up unless I do ssh -t, which makes sense - the library doesn't know it's a valid TTY.

Can we nevertheless get a way to force a prompt character to show up?

decentral1se commented 7 years ago

Maybe you could add a --force-tty option? Not sure if that is a typical thing to do though.

untitaker commented 6 years ago

@rcarmo If your entire Python process believes that it's not dealing with a shell, I don't think that just changing this behavior in click-repl will be enough. For example, you'll also be missing colors in click.echo since click itself will also believe it's not inside a TTY.

What you can do in your situation is to patch sys.stdout.isatty, or wrap something around your Python process that really makes Python see a TTY from the beginning.

For the reasons mentioned above and because this issue is quite inactive I'm closing this.