microsoft / terminal

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

Add a parameter for `--closeOnExit` #16060

Open htcfreek opened 1 year ago

htcfreek commented 1 year ago

Description of the new feature/enhancement

You can sett e keep open parameter as parameter of the shell used. But if this Is dynamic (e.g. in PowerToys shell plugin) a global parameter for WT would be helpful.

This parameter should keeps the WT window open regardless of the choosen profile and its parameters.

Proposed technical implementation details (optional)

zadjii-msft commented 1 year ago

Sorry could you elaborate more/? What exactly do you mean by "keep open"? Like, "always on top"? Or do you mean something more like "keep running even after I've closed all windows"? Or something else entirely? I'm not sure I'm totally familiar with all the powertoys these days 😝

htcfreek commented 1 year ago

@zadjii-msft What I mean is a wt.exe parameter like cmd /k or powershell -NoExit that works on all profiles regardless off the profile/shell.

Use case: Shell plugin of PT Run. The window should stay open to show the results. (Currently we need some tricks to keep the command results visible which lead to https://github.com/microsoft/PowerToys/issues/28876.)

zadjii-msft commented 1 year ago

Oh, so like, a wt command-line version of "closeOnExit":"never"?

htcfreek commented 1 year ago

Oh, so like, a wt command-line version of "closeOnExit":"never"?

yes

zadjii-msft commented 1 year ago

Er, well, reading that closer, that might not be quite right. -NoExit isn't just "leave the window open after the command completes", it's "Return to the shell prompt after the command exits". I'm pretty confident that can't be done in a general-purpose way.

Like, for cmd.exe, that would be cmd.exe /k {{command}}, sure. But what if the user's commandline is set to ssh? What if it's just ping.exe 8.8.8.8? wsl.exe tmux -a?

If the goal is just to leave the output on the screen after the command exits, that's easy enough to add with --closeOnExit=never or whatever. But returning to the shell is probably impossible, without manually setting the commandline to something like cmd.exe /c {command} & {shell} (which I'm sure is fraught with string excaping nightmares and other edge cases).

htcfreek commented 1 year ago

The main goal is to keep the window open for reading the output. So --closeOnExit=nerver or even much easier --keepWindowOpen is what we need.

htcfreek commented 12 months ago

@zadjii-msft I would like to work on this. But for the next three weeks I have no time. So if you feel this is important, please tell me and assign it to someone else.

Regarding the dev env: How many disk space do I need? Are there any special requirements I need to take care on?

zadjii-msft commented 12 months ago

Go for it! We're probably not going to get to this soon anyways.

RE: system reqs: Building cppwinrt code takes a lot of disk space for pch files. Last I checked, it was on the order of 20GB. I know that's a lot 😕 Otherwise, I'm pretty sure https://github.com/microsoft/terminal#prerequisites covers the rest

htcfreek commented 12 months ago

@zadjii-msft You can assign me.

Then I think 60 - 80 GB should be enough free disk space hopefully.

htcfreek commented 9 months ago

@zadjii-msft

  1. Can you tell me how to get rid of these errors when opening the project in VS? image
  2. I have build the Open Console solution using the PowerShell commands. But how can I start WT.exe now for testing? buildOutput.txt

@davidegiacometti, I know that you have contributed code to WT in the past. Do you have an idea what is wrong/missing?

davidegiacometti commented 9 months ago

Do you have the old .NET Framework SDK installed? WindowsTerminal.UIA.Tests project targets .NET Framework 4.8

htcfreek commented 9 months ago

Do you have the old .NET Framework SDK installed? WindowsTerminal.UIA.Tests project targets .NET Framework 4.8

Do I need to install it in VS using the VS installer or can I download and install the sdk?

I tried to install the .Net 4.8 target release package on weekends without fixing the VS warning.

davidegiacometti commented 9 months ago

I have the .NET 4.8 installed from VS

htcfreek commented 9 months ago

@davidegiacometti , @zadjii-msft I got it building and created my first WT PR. 🤩 I left some comments in the PR about not working things and some questions.