sendInput doesn't seem to work in multipleActions #17869

Open
opened 2026-01-31 05:56:50 +00:00 by claunia · 7 comments
Owner

Originally created by @cinnamon-msft on GitHub (Jul 6, 2022).

Windows Terminal version

1.15.1863.0

Windows build number

10.0.22824.0

Other Software

No response

Steps to reproduce

I'm attempting to open a new tab and then send input in that new tab using the multipleActions command.

{
    "command": 
    {
        "action": "multipleActions",
        "actions": [
            {
                "action": "newTab"
            },
            {
                "action": "sendInput",
                "input": "\u001b[A"
            }
        ]
    },
    "name": "Send Input Test"
},

Expected Behavior

The new tab should have the input sent from sendInput, which in this case is as if I pressed the up arrow in my buffer.

Actual Behavior

sendInput seems to be completely ignored and my input line is empty.

Originally created by @cinnamon-msft on GitHub (Jul 6, 2022). ### Windows Terminal version 1.15.1863.0 ### Windows build number 10.0.22824.0 ### Other Software _No response_ ### Steps to reproduce I'm attempting to open a new tab and then send input in that new tab using the `multipleActions` command. ``` { "command": { "action": "multipleActions", "actions": [ { "action": "newTab" }, { "action": "sendInput", "input": "\u001b[A" } ] }, "name": "Send Input Test" }, ``` ### Expected Behavior The new tab should have the input sent from `sendInput`, which in this case is as if I pressed the up arrow in my buffer. ### Actual Behavior `sendInput` seems to be completely ignored and my input line is empty.
Author
Owner

@zadjii-msft commented on GitHub (Jul 7, 2022):

Huh. Good point. I suspect that we just fire-and-forget these guys after startup. Kinda interesting that the input doesn't go anywhere though - not into the previous tab or the new one. That's odd for real.

@zadjii-msft commented on GitHub (Jul 7, 2022): Huh. Good point. I suspect that we just fire-and-forget these guys after startup. Kinda interesting that the input doesn't go _anywhere_ though - not into the previous tab or the new one. That's odd for real.
Author
Owner

@ianjoneill commented on GitHub (Jul 9, 2022):

So sendInput is only a problem if it's called after a new terminal control is created. If you just do two sendInput actions one after another they work fine.

The problem with running sendInput after newTab or splitPane is that the ConptyConnection hasn't been started yet - the ConptyConnection::WriteInput() method does nothing if the connection hasn't started.

bbc570d107/src/cascadia/TerminalConnection/ConptyConnection.cpp (L464-L475)

I guess you could make WriteInput() store the strings that are sent to it if it's in the NotConnected state, and re-play them once it gets into the Connected state?

@ianjoneill commented on GitHub (Jul 9, 2022): So `sendInput` is only a problem if it's called after a new terminal control is created. If you just do two `sendInput` actions one after another they work fine. The problem with running `sendInput` after `newTab` or `splitPane` is that the `ConptyConnection` hasn't been started yet - the `ConptyConnection::WriteInput()` method does nothing if the connection hasn't started. https://github.com/microsoft/terminal/blob/bbc570d107b6b67b68454355e04724ecea9c9796/src/cascadia/TerminalConnection/ConptyConnection.cpp#L464-L475 I guess you could make `WriteInput()` store the strings that are sent to it if it's in the `NotConnected` state, and re-play them once it gets into the `Connected` state?
Author
Owner

@mccarthyp-snet commented on GitHub (Aug 4, 2022):

So sendInput is only a problem if it's called after a new terminal control is created. If you just do two sendInput actions one after another they work fine.

It's not working for me:

{
    "name": "blah",
    "command": {
        "action": "multipleActions",
        "actions": [
            {
                "action": "sendInput",
                "input": "sensible-browser https://...\n"
            },
            {
                "action": "sendInput",
                "input": "sensible-browser https://...\n"
            }
        ]
    }
}

That just launches the first URL for me...

Running it in WSL/Ubuntu Profile.

@mccarthyp-snet commented on GitHub (Aug 4, 2022): > So `sendInput` is only a problem if it's called after a new terminal control is created. If you just do two `sendInput` actions one after another they work fine. It's not working for me: ``` { "name": "blah", "command": { "action": "multipleActions", "actions": [ { "action": "sendInput", "input": "sensible-browser https://...\n" }, { "action": "sendInput", "input": "sensible-browser https://...\n" } ] } } ``` That just launches the first URL for me... Running it in WSL/Ubuntu Profile.
Author
Owner

@jsilveira commented on GitHub (Mar 13, 2024):

Any known workaround for this bug? Sending the input twice is not working for me

@jsilveira commented on GitHub (Mar 13, 2024): Any known workaround for this bug? Sending the input twice is not working for me
Author
Owner

@o-sdn-o commented on GitHub (Jul 23, 2024):

Any known workaround for this?

As a workaround, you can try using vtm as a terminal session wrapper inside Windows Terminal to pass keystrokes on startup.

  • settings.json:
    {
      "command": 
      {
        "action": "newTab",
        "commandline": "vtm.exe -t -c \"<config><term sendinput='echo \\\"123\\\"\n'/></config>\" -r vtty pwsh"
      },
      "name": "Send Input Test (pwsh)"
    },
    {
      "command": 
      {
        "action": "newTab",
        "commandline": "vtm.exe -t -c \"<config><term sendinput='echo \\\"123\\\"\n'/></config>\" -r vtty cmd.exe"
      },
      "name": "Send Input Test (cmd.exe)"
    },
    
    
@o-sdn-o commented on GitHub (Jul 23, 2024): > Any known workaround for this? As a workaround, you can try using [vtm](https://github.com/directvt/vtm) as a terminal session wrapper inside Windows Terminal to pass keystrokes on startup. - `settings.json`: ``` { "command": { "action": "newTab", "commandline": "vtm.exe -t -c \"<config><term sendinput='echo \\\"123\\\"\n'/></config>\" -r vtty pwsh" }, "name": "Send Input Test (pwsh)" }, { "command": { "action": "newTab", "commandline": "vtm.exe -t -c \"<config><term sendinput='echo \\\"123\\\"\n'/></config>\" -r vtty cmd.exe" }, "name": "Send Input Test (cmd.exe)" }, ```
Author
Owner

@LaPeste commented on GitHub (Aug 5, 2024):

Is there any plan to fix this?

@LaPeste commented on GitHub (Aug 5, 2024): Is there any plan to fix this?
Author
Owner

@bronthulke commented on GitHub (Jul 11, 2025):

I've just come across this issue because I'm trying to get this exact scenario working as well. Any chance of an update, please?

@bronthulke commented on GitHub (Jul 11, 2025): I've just come across this issue because I'm trying to get this exact scenario working as well. Any chance of an update, please?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#17869