Skip to content

Allow terminals to be reused #18377

Closed

Description

@Tyriar

From Dirk Bäumer (@dbaeumer):

Reuse of a terminal. Not necessarily the terminal process more the terminal pane. If the user executes a task and the task finishes and runs the task again it would be cool if the output of the task could show up in the same terminal. Constantly pressing a key to close and old terminal might not be very intuitive.

Activity

  1. added
    terminal
    on Jan 10, 2017
  2. dbaeumer commented on Jan 11, 2017

    @dbaeumer
    Member

    For January we decided to keep the task in the core. So there is no need to make this 'public' API now. May be it would be good to first experiment a little with the new API.

  3. Tyriar commented on Jan 11, 2017

    @Tyriar
    ContributorAuthor

    Dirk Bäumer (@dbaeumer) just to make sure, were you thinking of using a waitOnExit prompt (press any key to close) that can be reused? Or a terminal that executes something, the pty process dies and just sits there ("dead") until another task command is sent?

  4. dbaeumer commented on Jan 12, 2017

    @dbaeumer
    Member

    Daniel Imms (@Tyriar) I would like to achieve the following:

    • create a new terminal and allow terminal reuse (could be an additional option) without actually running a terminal right away (if necessary we could run it as well)
    • run a command in the terminal. This will create the actual shell process. Usually the shell would be started with /c
    • receive an exit event when the shell exists
    • reuse the terminal to run another command in the terminal which creates a new shell process.

    Use case if for a build task: if the user runs the build tasks 3 times in a row I would like to have one terminal (e.g. on entry in the drop down in the terminal pane) which contains the output of all three task runs.

  5. dbaeumer commented on Jan 12, 2017

    @dbaeumer
    Member

    Daniel Imms (@Tyriar) I have one additional question. Does the terminal require to run a shell or would the terminal be able to run any other arbitrary process (for example a node.exe).

  6. dbaeumer commented on Jan 12, 2017

    @dbaeumer
    Member

    Daniel Imms (@Tyriar) I got it working to run an arbitrary program. Only drawback is that I needed to specify the full path to the program (e.g. "C:\\Program Files\\nodejs\\node.exe"). Any idea why this is the case?

  7. Tyriar commented on Jan 12, 2017

    @Tyriar
    ContributorAuthor

    Dirk Bäumer (@dbaeumer) do you mean the shell path you're using is node and it's not working like that? I guess the PATH resolution stuff is contained within cmd, I would think it would probably be safest to always wrap the command within cmd /c or sh -c.

    Wrapping the command means the process will die when it finishes so I don't see a downside?

  8. dbaeumer commented on Jan 12, 2017

    @dbaeumer
    Member

    Daniel Imms (@Tyriar) the only problem is argument passing with spaces contained. If you call node directly then you pass the args as a string[]. If you call the cmd.exe for example you need to construct a single string with proper arg quoting to ensure everything works when for example the command to call contains spaces.

    And you save a process :-)

  9. added a commit that references this issue on Jan 16, 2017
    abe753d
  10. gandhis1 commented on Jan 18, 2017

    @gandhis1

    Don Jayamanne (@DonJayamanne) could this be useful for Python terminal execution?

  11. locked and limited conversation to collaborators on Nov 18, 2017
  12. added a commit that references this issue on Sep 6, 2026
    9f8b3bc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

terminal

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions