Skip to content

[Process] Buggy terminal after interrupting TTY Process #44045

@tom-combet

Description

@tom-combet

Symfony version(s) affected

5.3

Description

Interrupting a Process with TTY mode in a Command leads to broken terminal: we can't see what we're typing anymore.

It happens only for processes that require user input several times. The bug occurs if there are remaining steps to complete the operation. So if we interrupt the process at the last step, bug doesn't occur.
Typically, my use case is using Maker Bundle. So for instance, bug occurs with make:entity, but not with make:controller.

How to reproduce

  1. Make a basic command with make:command or manually.
  2. Implement SignalableCommandInterface and susbcribe to SIGINT signal.
  3. Run a Process that require user input multiple times with TTY mode enabled in execute command function, like this:
        $process = Process::fromShellCommandline('php bin/console make:entity');
        $process->setTty(true);

        $process->run();
  1. Run command at the project root (php bin/console your-command).
  2. Interrupt command at the first step.
  3. See that you can't see what you're typing anymore in the terminal (but you're typing!).

Possible Solution

It should be a problem with standard input/output not given back to the parent process, but I don't have enough knowledge in systems to fix it alone...

Additional Context

image

As you can see, you don't see the php -v I entered after interrupting the Test command that launches make:entity process. Only the result of it appears.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy