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

[DxD] closeOnExit should be sensible when launched via defterm #13325

Closed
Andrew1988123123 opened this issue Jun 19, 2022 · 4 comments · Fixed by #13560
Closed

[DxD] closeOnExit should be sensible when launched via defterm #13325

Andrew1988123123 opened this issue Jun 19, 2022 · 4 comments · Fixed by #13560
Assignees
Labels
Area-DefApp Issue-Bug It either shouldn't be doing this or needs an investigation. Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting Priority-1 A description (P1) Product-Terminal The new Windows Terminal. Resolution-Fix-Committed Fix is checked in, but it might be 3-4 weeks until a release.

Comments

@Andrew1988123123
Copy link

Windows Terminal version

Windows Terminal Version: 1.13.11432.0

Windows build number

Microsoft Windows [Version 10.0.22000.739]

Other Software

No response

Steps to reproduce

  1. Turn PC on
  2. Wait approximately 30min
  3. Windows Terminal opens with error "ERROR: The specified directory does not exist."

Expected Behavior

Windows Terminal shouldn't opens every time I turn PC on.

Actual Behavior

Every time I turn PC on and approximately after 30min Windows Terminal automatically opens new windows terminal with error "ERROR: The specified directory does not exist." WT startup is turned off. I don't use additional script to open WT.
Screenshot of the error https://prnt.sc/OTSf0FKHT9Dt
Full tab path C:\WINDOWS\System32\forfiles.exe

@Andrew1988123123 Andrew1988123123 added the Issue-Bug It either shouldn't be doing this or needs an investigation. label Jun 19, 2022
@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 Jun 19, 2022
@zadjii-msft
Copy link
Member

Full tab path C:\WINDOWS\System32\forfiles.exe

Sounds like you've got the Windows Terminal set up as the default terminal emulator, and something you have installed is running a forfiles command. That forfiles is automatically launching in a Terminal window, instead of a console window. However, the Terminal doesn't automatically close when a commandline application exits with an error, unlike the console.

Now, trick here is that forfiles here isn't actually telling you what the missing directory is, just that it couldn't find it. I honestly don't know how you'd figure out who's launching that.

You might be able to mitigate this by setting closeOnExit: always in the profiles.defaults part of the settings.

I think we had previously discussed defterm invocations defaulting to that value - lemme bring that up with the team again.

@zadjii-msft zadjii-msft added Area-DefApp Needs-Discussion Something that requires a team discussion before we can proceed labels Jun 20, 2022
@zadjii-msft
Copy link
Member

🌶️ take: for a defterm session, if the profile doesn't have a closeOnExit set, we treat that as always, instead of graceful. We'd need to change that setting to an optional, but because it gets exposed from Profile as a winrt type, it'd need to be an IReference<CloseOnExitMode>, which is a little gross.

@zadjii-msft zadjii-msft added this to the Terminal v1.16 milestone Jul 11, 2022
@zadjii-msft
Copy link
Member

discusssion:

  • is "close on exit" for things started by the Terminal? Can we just reframe graceful to "always" for defterm?
  • Meh, lets do the optional thing above?
  • Meh lets just just do always as the default?
  • Maybe we should have an setting between always and graceful "always so long as we actually got some bytes out of the connection"
  • but uhg, that's not actually helpful for defterm
  • you can't actually set graceful explicitly in the SUI - the profile will already say you're set to "graceful"
  • Maybe there needs to be "gracefulIfLaunchedByTerminal", which is the new default, which is "always" for defterm. It's annoying but okay.

@zadjii-msft zadjii-msft added Product-Terminal The new Windows Terminal. Priority-1 A description (P1) and removed Needs-Discussion Something that requires a team discussion before we can proceed labels Jul 11, 2022
@ghost ghost removed the Needs-Tag-Fix Doesn't match tag requirements label Jul 11, 2022
@zadjii-msft zadjii-msft changed the title ERROR: The specified directory does not exist. [DxD] closeOnExit should be sensible when launched via defterm Jul 11, 2022
@zadjii-msft zadjii-msft self-assigned this Jul 19, 2022
@ghost ghost added the In-PR This issue has a related PR label Jul 21, 2022
@ghost ghost closed this as completed in #13560 Aug 1, 2022
@ghost ghost removed the In-PR This issue has a related PR label Aug 1, 2022
ghost pushed a commit that referenced this issue Aug 1, 2022
## Summary of the Pull Request
Adds a new mode to `CloseOnExit`: `Automatic`. In this mode, if a process handed off by defterm terminates for whatever reason, we always close (i.e. we treat the mode as `Always`), but for processes launched by Terminal we terminate as with the `Graceful` behaviour. 

## PR Checklist
* [x] Closes #13325 
* [x] CLA signed. If not, go over [here](https://cla.opensource.microsoft.com/microsoft/Terminal) and sign the CLA
* [ ] Tests added/passed
* [ ] Documentation updated. If checked, please file a pull request on [our docs repo](https://github.com/MicrosoftDocs/terminal) and link it here: #xxx
* [ ] Schema updated.
* [x] I've discussed this with core contributors already. If not checked, I'm ready to accept this work might be rejected in favor of a different grand plan. Issue number where discussion took place: #xxx

## Detailed Description of the Pull Request / Additional comments

- Adds a new enum value to `CloseOnExit`
- Adds a new function to `Pane`: `FinalizeConfigurationGivenDefault`: this is a function that should be called when the pane is created via default terminal handoff, and can contain any special configurations we should set given that the pane was created via handoff

## Validation Steps Performed
@ghost ghost added the Resolution-Fix-Committed Fix is checked in, but it might be 3-4 weeks until a release. label Aug 1, 2022
DHowett pushed a commit that referenced this issue Aug 8, 2022
## Summary of the Pull Request
Adds a new mode to `CloseOnExit`: `Automatic`. In this mode, if a process handed off by defterm terminates for whatever reason, we always close (i.e. we treat the mode as `Always`), but for processes launched by Terminal we terminate as with the `Graceful` behaviour.

## PR Checklist
* [x] Closes #13325
* [x] CLA signed. If not, go over [here](https://cla.opensource.microsoft.com/microsoft/Terminal) and sign the CLA
* [ ] Tests added/passed
* [ ] Documentation updated. If checked, please file a pull request on [our docs repo](https://github.com/MicrosoftDocs/terminal) and link it here: #xxx
* [ ] Schema updated.
* [x] I've discussed this with core contributors already. If not checked, I'm ready to accept this work might be rejected in favor of a different grand plan. Issue number where discussion took place: #xxx

## Detailed Description of the Pull Request / Additional comments

- Adds a new enum value to `CloseOnExit`
- Adds a new function to `Pane`: `FinalizeConfigurationGivenDefault`: this is a function that should be called when the pane is created via default terminal handoff, and can contain any special configurations we should set given that the pane was created via handoff

## Validation Steps Performed

(cherry picked from commit 89d57e8)
Service-Card-Id: 84836029
Service-Version: 1.15
@ghost
Copy link

ghost commented Aug 17, 2022

🎉This issue was addressed in #13560, which has now been successfully released as Windows Terminal Preview v1.15.228.:tada:

Handy links:

This issue was closed.
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-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting Priority-1 A description (P1) Product-Terminal The new Windows Terminal. Resolution-Fix-Committed Fix is checked in, but it might be 3-4 weeks until a release.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants