Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

"Enter" key unexpected behaviour while launching a redis shell

Open
#917 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
python
Domain
cli

Research direction

Reproduce the issue with the provided redis-cli task on Ubuntu 20.04 and inspect runner._run_body, where the problem is suspected. Compare its behavior with direct os.execve execution and review the mentioned pseudo-terminal, pty, thread handling, and fcntl interactions. Done means pressing Enter runs the Redis command instead of inserting a line break.

Written by the indexing model from the issue text.

Description

I think my issue is linked to https://github.com/pyinvoke/invoke/issues/733

python: 3.10.5
invoke: 2.0.0
os: Ubuntu 20.04

I want to open a redis shell, using redis-cli.

from invoke import task

@task()
def test(context):
    context.run("redis-cli", pty=True)

The problem is the "Enter" key prints a linebreak, instead of running the Redis command.

After some digging in the code, I found out the actual execution of the command in invoke is done by os.execve(shell, [shell, "-c", command], env). If I run this line in a python shell, it works as expected, the issue only happens when running the code through runner._run_body, probably because of a problem with the thread handling.

I'd be happy to help debugging / fixing this issue, but I don't have a big understanding on how pseudo-terminals / pty / fcntl work, so I'd need some help doing this.

Dominant language
Python
Stars
4.8k
Forks
412
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from pyinvoke/invoke

All issues in pyinvoke/invoke

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.