Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running as a default terminal causes app to create terminal window #11627

Closed
Mayhem93 opened this issue Oct 27, 2021 · 20 comments
Closed

Running as a default terminal causes app to create terminal window #11627

Mayhem93 opened this issue Oct 27, 2021 · 20 comments
Labels
Area-DefApp Issue-Bug It either shouldn't be doing this or needs an investigation. Needs-Tag-Fix Doesn't match tag requirements Priority-1 A description (P1) Product-Terminal The new Windows Terminal. Resolution-Duplicate There's another issue on the tracker that's pretty much the same thing.

Comments

@Mayhem93
Copy link

Windows Terminal version (or Windows build number)

10.0.22000.0, 1.11.2921.0

Other Software

CoolerMaster MasterPlus (I couldn't find any version string :( but it's a 2-3 week old fresh install)

Steps to reproduce

Make Windows Terminal the default terminal.

Install CoolerMaster MasterPlus (I don't think it's a requirement to have any of their hardware to use it) and on every reboot there's a service called MPService that starts a process with a console host attached:
image

Then a windows terminal window appears:
image

And every time I close it (obviously the process ends) the service restarts the program (so the only way to get rid of this is to stop the service).

Expected Behavior

Expected behavior should be the same when conhost was the default console terminal (no window creation, the program ran in the background)

Actual Behavior

The terminal window appears every time this service runs the said program instead of having it in the background somehow.

@ghost ghost added Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting Needs-Tag-Fix Doesn't match tag requirements labels Oct 27, 2021
@zadjii-msft
Copy link
Member

@miniksa Add this to the list of "things that spawn a visible console window (and therefore launch into defterm) when they ideally shouldn't"

@zadjii-msft zadjii-msft added Area-DefApp Issue-Bug It either shouldn't be doing this or needs an investigation. Priority-1 A description (P1) Product-Terminal The new Windows Terminal. labels Oct 27, 2021
@ghost ghost removed the Needs-Tag-Fix Doesn't match tag requirements label Oct 27, 2021
@zadjii-msft zadjii-msft added this to the Terminal v2.0 milestone Oct 27, 2021
@Mayhem93
Copy link
Author

I also want to add that this only happens with MasterPlus on my machine, the others don't create any visible windows terminal

@Mayhem93
Copy link
Author

ALSO another thing to note: making windows terminal the default one any new terminal hosts will try to open the default profile. I have Ubuntu as my default one and I wish to have it, but unfortunately I have to change it back to powershell

@zadjii-msft
Copy link
Member

any new terminal hosts will try to open the default profile. I have Ubuntu as my default one and I wish to have it, but unfortunately I have to change it back to powershell

That doesn't seem right, I thought we fixed that. Can you share your settings.json?

@Mayhem93
Copy link
Author

Mayhem93 commented Oct 27, 2021

@zadjii-msft

"Open in Windows Terminal" context menu doesn't work, I forgot to mention. I ran cmd.exe from win+R and it correctly opened cmd.

"Open in Windows Terminal" opens it in Ubuntu with the default location I've set it up to, like here:
image

If this is a bug, let me know so I can make a separate ticket for this :)

@zadjii-msft
Copy link
Member

Might be easiest to diagnose your issues with the whole settings.json file

@Mayhem93
Copy link
Author

{
    "$schema": "https://aka.ms/terminal-profiles-schema",
    "actions": 
    [
        {
            "command": 
            {
                "action": "copy",
                "singleLine": false
            },
            "keys": "ctrl+c"
        },
        {
            "command": "find",
            "keys": "ctrl+shift+f"
        },
        {
            "command": "paste",
            "keys": "ctrl+v"
        },
        {
            "command": 
            {
                "action": "newTab"
            },
            "keys": "ctrl+t"
        },
        {
            "command": "duplicateTab",
            "keys": "ctrl+shift+t"
        },
        {
            "command": 
            {
                "action": "closeTab"
            },
            "keys": "ctrl+w"
        },
        {
            "command": 
            {
                "action": "splitPane",
                "split": "auto",
                "splitMode": "duplicate"
            },
            "keys": "alt+shift+d"
        }
    ],
    "copyFormatting": "none",
    "copyOnSelect": false,
    "defaultProfile": "{2c4de342-38b7-51cf-b940-2309a097f518}",
    "initialCols": 150,
    "initialPosition": "620,300",
    "initialRows": 40,
    "profiles": 
    {
        "defaults": {},
        "list": 
        [
            {
                "antialiasingMode": "cleartype",
                "bellStyle": "audible",
                "colorScheme": "VibrantTom",
                "font": 
                {
                    "face": "Cascadia Code"
                },
                "guid": "{574e775e-4f2a-5b96-ac1e-a2962a402336}",
                "hidden": false,
                "name": "PowerShell",
                "source": "Windows.Terminal.PowershellCore"
            },
            {
                "acrylicOpacity": 0.59999999999999998,
                "background": "#2D0133",
                "bellStyle": "audible",
                "commandline": "wsl.exe ~ -d Ubuntu",
                "cursorShape": "filledBox",
                "experimental.retroTerminalEffect": false,
                "font": 
                {
                    "face": "Source Code Pro",
                    "size": 11,
                    "weight": "normal"
                },
                "guid": "{2c4de342-38b7-51cf-b940-2309a097f518}",
                "hidden": false,
                "name": "Ubuntu",
                "source": "Windows.Terminal.Wsl",
                "startingDirectory": null,
                "useAcrylic": true
            },
            {
                "guid": "{b453ae62-4e3d-5e58-b989-0a998ec441b8}",
                "hidden": true,
                "name": "Azure Cloud Shell",
                "source": "Windows.Terminal.Azure"
            }
        ]
    },
    "schemes": 
    [
        {
            "background": "#0C0C0C",
            "black": "#0C0C0C",
            "blue": "#0037DA",
            "brightBlack": "#767676",
            "brightBlue": "#3B78FF",
            "brightCyan": "#61D6D6",
            "brightGreen": "#16C60C",
            "brightPurple": "#B4009E",
            "brightRed": "#E74856",
            "brightWhite": "#F2F2F2",
            "brightYellow": "#F9F1A5",
            "cursorColor": "#FFFFFF",
            "cyan": "#3A96DD",
            "foreground": "#CCCCCC",
            "green": "#13A10E",
            "name": "Campbell",
            "purple": "#881798",
            "red": "#C50F1F",
            "selectionBackground": "#FFFFFF",
            "white": "#CCCCCC",
            "yellow": "#C19C00"
        },
        {
            "background": "#012456",
            "black": "#0C0C0C",
            "blue": "#0037DA",
            "brightBlack": "#767676",
            "brightBlue": "#3B78FF",
            "brightCyan": "#61D6D6",
            "brightGreen": "#16C60C",
            "brightPurple": "#B4009E",
            "brightRed": "#E74856",
            "brightWhite": "#F2F2F2",
            "brightYellow": "#F9F1A5",
            "cursorColor": "#FFFFFF",
            "cyan": "#3A96DD",
            "foreground": "#CCCCCC",
            "green": "#13A10E",
            "name": "Campbell Powershell",
            "purple": "#881798",
            "red": "#C50F1F",
            "selectionBackground": "#FFFFFF",
            "white": "#CCCCCC",
            "yellow": "#C19C00"
        },
        {
            "background": "#282A36",
            "black": "#21222C",
            "blue": "#BD93F9",
            "brightBlack": "#6272A4",
            "brightBlue": "#D6ACFF",
            "brightCyan": "#A4FFFF",
            "brightGreen": "#69FF94",
            "brightPurple": "#FF92DF",
            "brightRed": "#FF6E6E",
            "brightWhite": "#FFFFFF",
            "brightYellow": "#FFFFA5",
            "cursorColor": "#FFFFFF",
            "cyan": "#8BE9FD",
            "foreground": "#F8F8F2",
            "green": "#50FA7B",
            "name": "Dracula",
            "purple": "#FF79C6",
            "red": "#FF5555",
            "selectionBackground": "#FFFFFF",
            "white": "#F8F8F2",
            "yellow": "#F1FA8C"
        },
        {
            "background": "#282C34",
            "black": "#282C34",
            "blue": "#61AFEF",
            "brightBlack": "#5A6374",
            "brightBlue": "#61AFEF",
            "brightCyan": "#56B6C2",
            "brightGreen": "#98C379",
            "brightPurple": "#C678DD",
            "brightRed": "#E06C75",
            "brightWhite": "#DCDFE4",
            "brightYellow": "#E5C07B",
            "cursorColor": "#FFFFFF",
            "cyan": "#56B6C2",
            "foreground": "#DCDFE4",
            "green": "#98C379",
            "name": "One Half Dark",
            "purple": "#C678DD",
            "red": "#E06C75",
            "selectionBackground": "#FFFFFF",
            "white": "#DCDFE4",
            "yellow": "#E5C07B"
        },
        {
            "background": "#FAFAFA",
            "black": "#383A42",
            "blue": "#0184BC",
            "brightBlack": "#4F525D",
            "brightBlue": "#61AFEF",
            "brightCyan": "#56B5C1",
            "brightGreen": "#98C379",
            "brightPurple": "#C577DD",
            "brightRed": "#DF6C75",
            "brightWhite": "#FFFFFF",
            "brightYellow": "#E4C07A",
            "cursorColor": "#4F525D",
            "cyan": "#0997B3",
            "foreground": "#383A42",
            "green": "#50A14F",
            "name": "One Half Light",
            "purple": "#A626A4",
            "red": "#E45649",
            "selectionBackground": "#FFFFFF",
            "white": "#FAFAFA",
            "yellow": "#C18301"
        },
        {
            "background": "#002B36",
            "black": "#002B36",
            "blue": "#268BD2",
            "brightBlack": "#073642",
            "brightBlue": "#839496",
            "brightCyan": "#93A1A1",
            "brightGreen": "#586E75",
            "brightPurple": "#6C71C4",
            "brightRed": "#CB4B16",
            "brightWhite": "#FDF6E3",
            "brightYellow": "#657B83",
            "cursorColor": "#FFFFFF",
            "cyan": "#2AA198",
            "foreground": "#839496",
            "green": "#859900",
            "name": "Solarized Dark",
            "purple": "#D33682",
            "red": "#DC322F",
            "selectionBackground": "#FFFFFF",
            "white": "#EEE8D5",
            "yellow": "#B58900"
        },
        {
            "background": "#FDF6E3",
            "black": "#002B36",
            "blue": "#268BD2",
            "brightBlack": "#073642",
            "brightBlue": "#839496",
            "brightCyan": "#93A1A1",
            "brightGreen": "#586E75",
            "brightPurple": "#6C71C4",
            "brightRed": "#CB4B16",
            "brightWhite": "#FDF6E3",
            "brightYellow": "#657B83",
            "cursorColor": "#002B36",
            "cyan": "#2AA198",
            "foreground": "#657B83",
            "green": "#859900",
            "name": "Solarized Light",
            "purple": "#D33682",
            "red": "#DC322F",
            "selectionBackground": "#FFFFFF",
            "white": "#EEE8D5",
            "yellow": "#B58900"
        },
        {
            "background": "#000000",
            "black": "#000000",
            "blue": "#3465A4",
            "brightBlack": "#555753",
            "brightBlue": "#729FCF",
            "brightCyan": "#34E2E2",
            "brightGreen": "#8AE234",
            "brightPurple": "#AD7FA8",
            "brightRed": "#EF2929",
            "brightWhite": "#EEEEEC",
            "brightYellow": "#FCE94F",
            "cursorColor": "#FFFFFF",
            "cyan": "#06989A",
            "foreground": "#D3D7CF",
            "green": "#4E9A06",
            "name": "Tango Dark",
            "purple": "#75507B",
            "red": "#CC0000",
            "selectionBackground": "#FFFFFF",
            "white": "#D3D7CF",
            "yellow": "#C4A000"
        },
        {
            "background": "#FFFFFF",
            "black": "#000000",
            "blue": "#3465A4",
            "brightBlack": "#555753",
            "brightBlue": "#729FCF",
            "brightCyan": "#34E2E2",
            "brightGreen": "#8AE234",
            "brightPurple": "#AD7FA8",
            "brightRed": "#EF2929",
            "brightWhite": "#EEEEEC",
            "brightYellow": "#FCE94F",
            "cursorColor": "#000000",
            "cyan": "#06989A",
            "foreground": "#555753",
            "green": "#4E9A06",
            "name": "Tango Light",
            "purple": "#75507B",
            "red": "#CC0000",
            "selectionBackground": "#FFFFFF",
            "white": "#D3D7CF",
            "yellow": "#C4A000"
        },
        {
            "background": "#16171D",
            "black": "#878787",
            "blue": "#44B4CC",
            "brightBlack": "#E373C8",
            "brightBlue": "#0000FF",
            "brightCyan": "#19D1D8",
            "brightGreen": "#81EC0D",
            "brightPurple": "#FF00FF",
            "brightRed": "#FF0000",
            "brightWhite": "#E5E5E5",
            "brightYellow": "#FFD93D",
            "cursorColor": "#FFFFFF",
            "cyan": "#19D1D8",
            "foreground": "#FFFFFF",
            "green": "#CCFF04",
            "name": "VibrantTom",
            "purple": "#9933CC",
            "red": "#FF6600",
            "selectionBackground": "#FFFFFF",
            "white": "#F5F5F5",
            "yellow": "#FFD93D"
        },
        {
            "background": "#000000",
            "black": "#000000",
            "blue": "#000080",
            "brightBlack": "#808080",
            "brightBlue": "#0000FF",
            "brightCyan": "#00FFFF",
            "brightGreen": "#00FF00",
            "brightPurple": "#FF00FF",
            "brightRed": "#FF0000",
            "brightWhite": "#FFFFFF",
            "brightYellow": "#FFFF00",
            "cursorColor": "#FFFFFF",
            "cyan": "#008080",
            "foreground": "#C0C0C0",
            "green": "#008000",
            "name": "Vintage",
            "purple": "#800080",
            "red": "#800000",
            "selectionBackground": "#FFFFFF",
            "white": "#C0C0C0",
            "yellow": "#808000"
        }
    ],
    "tabWidthMode": "equal",
    "trimBlockSelection": true,
    "wordDelimiters": " /\\()\"'-.,:;<>~!@#$%^&*|+=[]{}~?\u2502"
}

@DHowett
Copy link
Member

DHowett commented Oct 27, 2021

If I had to guess, MasterPlus starts a completely visible console window and then attempts to hide it.

There are much better options they could consider, such as not being a console subsystem application.

@Mayhem93
Copy link
Author

If I had to guess, MasterPlus starts a completely visible console window and then attempts to hide it.

There are much better options they could consider, such as not being a console subsystem application.

Yeah but how come it doesn't happen with the old conhost ? I've never seen that, although I had some start up programs in the past which would do that (then immediately close)

@miniksa
Copy link
Member

miniksa commented Oct 27, 2021

The old console host exposes its raw window handle which can be retrieved and then force-hidden through an API if a client application wants to do that. It's not the right way of doing things, but it is a way that can appear to "work" on systems fast enough for it to not show anything.

We provide ample flags to be given during the initial CreateProcess call that would prevent the window from being shown in the first place (negating the need to grab the handle and hide it quickly).

With the Terminal, there aren't strictly window handles to be given out to do this operation as it's a tabbed interface all hosted in one window. There are a few things I could try to do heuristically to detect this situation and hide it to some degree... but I'd want to see a more widespread set of these incidents across multiple applications before I pursued that.

However, we haven't even validated that this is what MasterPlus is doing. So I would want to reproduce and figure that out first.

@Mayhem93
Copy link
Author

@miniksa Ok thanks for your input. Let's see what's going on and maybe I'll send them the issue over so they can update it's app

@oising
Copy link
Collaborator

oising commented Oct 27, 2021

I think this probably belongs here, but my machine went to sleep and when it woke up, I have this:

image

The title in the task bar is "Command Prompt" and bizarrely, I cannot close the window -- i.e. alt+f4 or clicking on the "x" does nothing.

More info -- it appears to have been spawned by svchost:

image

This particular svchost is hosting:

image

@oising
Copy link
Collaborator

oising commented Oct 27, 2021

So it seems to be something entirely Microsoft spawned -- the command line only has -Embedding on the end of the exe path. Nothing special.

Update: I spawned a tab to see if I had SYSTEM access (hahah) and thankfully it spawned under my creds. I noticed that once I had a single tab running, I was able to close the entire process.

@Eveldee
Copy link

Eveldee commented Nov 4, 2021

Same issue using Syncthing, their doc recommends to create a startup task with options to disable the console: "C:\Program Files\Syncthing\syncthing.exe" -no-console -no-browser but on Windows 11 using Windows Terminal as default makes the console window visible instead of hiding it (works perfectly with conhost as default).

Syncthing

Edit: code responsible for hiding the console on Windows

@silverqx
Copy link

I have the same issue with more apps, eg Qt Maintenace Tool for windows opens a visible terminal, I let know about other apps when I discover which one opens these terminals.

@zadjii-msft zadjii-msft modified the milestones: 22H1, Terminal v1.14 Feb 2, 2022
@DHowett DHowett removed the Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting label Feb 14, 2022
@silverqx
Copy link

Ok, after a few weeks of use I can tell that the Qt Maintenance tool is only one application that opens a visible terminal window, I'm pretty sure that wterm behaves correctly and this will be Qt Maintenance Tool problem. Personally, I have not observed any wrong behavior of the wterm. 😁

@silverqx
Copy link

There still can be a problem that is described in this issue, I have not tested it with CoolerMaster MasterPlus like is described in the first post, but I have tested with dozens of applications that I'm using.

@Mayhem93
Copy link
Author

I just realized the issue in my case is not present anymore. I don't know at what version it was fixed because I had conhost as default and somehow it automatically changed it to windows terminal without me knowing.

@zadjii-msft
Copy link
Member

Okay, I can confirm that this is seemingly fixed for CoolerMaster. Impossible to say if it was due to an OS-side defterm fix, a Terminal-side fix, or a CoolerMaster-side one.

The ShowWindow thing should have been fixed by #12515

Anything else that's in this bucket seems like it's probably a variant of /dup #12154. I'm gonna keep using that one to track it, since that's a little more narrowed down to the root cause.

Thanks all!

@zadjii-msft zadjii-msft closed this as not planned Won't fix, can't repro, duplicate, stale May 2, 2022
@ghost ghost added the Needs-Tag-Fix Doesn't match tag requirements label May 2, 2022
@ghost
Copy link

ghost commented May 2, 2022

Hi! We've identified this issue as a duplicate of another one that already exists on this Issue Tracker. This specific instance is being closed in favor of tracking the concern over on the referenced thread. Thanks for your report!

@ghost ghost added the Resolution-Duplicate There's another issue on the tracker that's pretty much the same thing. label May 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-DefApp Issue-Bug It either shouldn't be doing this or needs an investigation. Needs-Tag-Fix Doesn't match tag requirements Priority-1 A description (P1) Product-Terminal The new Windows Terminal. Resolution-Duplicate There's another issue on the tracker that's pretty much the same thing.
Projects
None yet
Development

No branches or pull requests

7 participants