microsoft / terminal

The new Windows Terminal and the original Windows console host, all in the same place!
MIT License
95.97k stars 8.35k forks source link

terminated tab remains open #7670

Closed zsbolyoczki closed 4 years ago

zsbolyoczki commented 4 years ago

Environment

Windows build number: Microsoft Windows [Version 10.0.19041.450]
Windows Terminal version (if applicable): 1.2.2381.0

Steps to reproduce

  1. open ssh terminal
  2. exit the terminal (press CTRL - D)
  3. sometimes the tab remains open with exit code greater than zero

Expected behavior

There should be an option to close tabs regardless the exit code.

zadjii-msft commented 4 years ago

You know, there is already an option to control if tabs closeOnExit, maybe you should check out the docs

zsbolyoczki commented 4 years ago

I'm aware of that option and it's set to "closeOnExit": "always"

DHowett commented 4 years ago

Thanks. Since it looks like closeOnExit isn't working, could you share a copy (or the appropriate snippet) of your settings.json?

zsbolyoczki commented 4 years ago

settings.json

//
// https://github.com/microsoft/terminal/blob/master/doc/cascadia/SettingsSchema.md#profiles
//

{
  "$schema": "https://aka.ms/terminal-profiles-schema",
  "wordDelimiters": " \"'<>,:;=()[]{}", 
  "alwaysShowTabs": true,
  "closeOnExit": "always",
  "theme": "dark",
  "defaultProfile": "{07b52e3e-de2c-5db4-bd2d-ba144ed6c273}",
  "copyOnSelect": true,
  "copyFormatting": false,
  "largePasteWarning": false,
  "multiLinePasteWarning": false,
  "profiles": {
    "defaults": {
      // https://atomcorp.github.io/themes/
      "colorScheme": "Dracula",
      "cursorShape": "vintage"
    },
    "list": [ {
        "guid": "{07b52e3e-de2c-5db4-bd2d-ba144ed6c273}",
        "hidden": false,
        "name": "Ubuntu-20.04",
        "source": "Windows.Terminal.Wsl",
        "padding": "20, 20, 10, 10",
        "selectionBackground": "#ffbbcc",

      },
      {
        "guid": "{b453ae62-4e3d-5e58-b989-0a998ec441b8}",
        "hidden": false,
        "name": "Azure Cloud Shell",
        "source": "Windows.Terminal.Azure"
      },
      {
          "guid": "{07b52e3e-de2c-5db4-bd2d-ba144ed6c273}",
          "hidden": false,
          "name": "Ubuntu-20.04",
          "source": "Windows.Terminal.Wsl"
      }
    ]
  },
  "schemes": [  {
      "name": "Afterglow",
      "black": "#151515",
      "red": "#ac4142",
      "green": "#7e8e50",
      "yellow": "#e5b567",
      "blue": "#6c99bb",
      "purple": "#9f4e85",
      "cyan": "#7dd6cf",
      "white": "#d0d0d0",
      "brightBlack": "#505050",
      "brightRed": "#ac4142",
      "brightGreen": "#7e8e50",
      "brightYellow": "#e5b567",
      "brightBlue": "#6c99bb",
      "brightPurple": "#9f4e85",
      "brightCyan": "#7dd6cf",
      "brightWhite": "#f5f5f5",
      "background": "#212121",
      "foreground": "#d0d0d0"
    },
    {
      // https://draculatheme.com/
      "name" : "Dracula",
      "background" : "#272935",
      "black" : "#21222C",
      "blue" : "#BD93F9",
      "cyan" : "#8BE9FD",
      "foreground" : "#F8F8F2",
      "green" : "#50FA7B",
      "purple" : "#FF79C6",
      "red" : "#FF5555",
      "white" : "#F8F8F2",
      "yellow" : "#FFB86C",
      "brightBlack" : "#6272A4",
      "brightBlue" : "#D6ACFF",
      "brightCyan" : "#A4FFFF",
      "brightGreen" : "#69FF94",
      "brightPurple" : "#FF92DF",
      "brightRed" : "#FF6E6E",
      "brightWhite" : "#F8F8F2",
      "brightYellow" : "#FFFFA5"
    },
    {
      "name": "Breeze",
      "black": "#31363b",
      "red": "#ed1515",
      "green": "#11d116",
      "yellow": "#f67400",
      "blue": "#1d99f3",
      "purple": "#9b59b6",
      "cyan": "#1abc9c",
      "white": "#eff0f1",
      "brightBlack": "#7f8c8d",
      "brightRed": "#c0392b",
      "brightGreen": "#1cdc9a",
      "brightYellow": "#fdbc4b",
      "brightBlue": "#3daee9",
      "brightPurple": "#8e44ad",
      "brightCyan": "#16a085",
      "brightWhite": "#fcfcfc",
      "background": "#31363b",
      "foreground": "#eff0f1"
    },
    {
      "name": "Calamity",
      "black": "#2f2833",
      "red": "#fc644d",
      "green": "#a5f69c",
      "yellow": "#e9d7a5",
      "blue": "#3b79c7",
      "purple": "#f92672",
      "cyan": "#74d3de",
      "white": "#d5ced9",
      "brightBlack": "#7e6c88",
      "brightRed": "#fc644d",
      "brightGreen": "#a5f69c",
      "brightYellow": "#e9d7a5",
      "brightBlue": "#3b79c7",
      "brightPurple": "#f92672",
      "brightCyan": "#74d3de",
      "brightWhite": "#ffffff",
      "background": "#2f2833",
      "foreground": "#d5ced9"
    }
  ]
}
"keybindings": [
  { "command": {"action": "copy", "singleLine": false }, "keys": "ctrl+c" },
  { "command": "paste", "keys": "ctrl+v" },
  { "command": "find", "keys": "ctrl+shift+f" },
  { "command": "newTab", "keys": "ctrl+shift+t"},
  { "command": { "action": "splitPane", "split": "vertical" }, "keys": "alt+shift+-" }

]
}
DHowett commented 4 years ago

Ah! You will need to move closeOnExit into the profiles.defaults section. Since we made it a per-profile property (so that you could set closeOnExit differently for WSL and for your "production server SSH" or whatever profiles), it has to go into the profiles section.

Does that work for you?

zsbolyoczki commented 4 years ago

Give me a couple of hours to test it because it doesn't happen every time.

DHowett commented 4 years ago

I can usually make this happen reliably by pressing ^C ^D. This makes zsh at least exit with code 130, which is regarded as a failure.

zsbolyoczki commented 4 years ago

It seems OK, thanks for the info! I close the issue.