Directory parameter in new terminal instance still "in use" after its corresponding tab is closed #16932

Closed
opened 2026-01-31 05:27:38 +00:00 by claunia · 3 comments
Owner

Originally created by @Araxeus on GitHub (Mar 5, 2022).

Windows Terminal version

1.13.10395.0

Windows build number

10.0.19044.1526

Steps to reproduce

  1. Open new terminal instance with a certain directory as a parameter (I used shell context menu but its the same as wt.exe -d "C:\Git\test")
  2. Open a new tab
  3. Close the first terminal tab (Or navigate to a different cwd using cd)
  4. Try to delete/rename the directory provided as param

Expected Behavior

Folder isn't in use and can be deleted/renamed etc (since the tab using the folder was closed)

it behaves correctly (sub process "use" the folder until its closed) when:

  • the terminal was already open and wt.exe -d "C:\Git\test" just opened a new tab inside it
  • the folder was navigated to from within the terminal with cd command)

Actual Behavior

Folder in use: (tried deleting it)
image

Terminal process is still "using" the file: (while the cmd.exe process that was actually using it was closed)
image

Tab isn't open in Terminal: (closed the tab that was opened when the terminal launched via the -d param)
image

(The only way to "regain access" to said folder, is to completely close the terminal)

My opinion

  • Whenever a terminal tab launch, its process (i.e cmd.exe) register access to the current cwd.
  • When the terminal is launched with the -d parameter the main process (WindowsTerminal.exe) register itself as using the directory, along with the tab sub process (i.e cmd.exe) but never release it
    ↓↓↓
    Directory is registered by the sub process anyways, the terminal process shouldn't register it at all (or atleast release it after the corresponding tab/process was closed / navigated away)
Originally created by @Araxeus on GitHub (Mar 5, 2022). ### Windows Terminal version 1.13.10395.0 ### Windows build number 10.0.19044.1526 ### Steps to reproduce 1. Open new terminal instance with a certain directory as a parameter (I used shell context menu but its the same as `wt.exe -d "C:\Git\test"`) 2. Open a new tab 3. Close the first terminal tab (Or navigate to a different `cwd` using `cd`) 4. Try to delete/rename the directory provided as param ### Expected Behavior Folder isn't in use and can be deleted/renamed etc (since the tab using the folder was closed) it behaves correctly (sub process "use" the folder until its closed) when: * the terminal was already open and `wt.exe -d "C:\Git\test"` just opened a new tab inside it * the folder was navigated to from within the terminal with `cd` command) ### Actual Behavior Folder in use: (tried deleting it) ![image](https://user-images.githubusercontent.com/78568641/156883112-db5bf99e-529f-4746-b369-5d90e38c40ce.png) Terminal process is still "using" the file: (while the `cmd.exe` process that was actually using it was closed) ![image](https://user-images.githubusercontent.com/78568641/156883803-af5dffa0-1643-405a-91e7-34483d0d47d7.png) Tab isn't open in Terminal: (closed the tab that was opened when the terminal launched via the `-d` param) ![image](https://user-images.githubusercontent.com/78568641/156883718-4d783530-7d0b-4736-9646-afa3b871b6b4.png) (The only way to "regain access" to said folder, is to completely close the terminal) ### My opinion * Whenever a terminal tab launch, its process (i.e `cmd.exe`) register access to the current `cwd`. * When the terminal is launched with the `-d` parameter the main process (`WindowsTerminal.exe`) register itself as using the directory, along with the tab sub process (i.e `cmd.exe`) but never release it ↓↓↓ Directory is registered by the sub process anyways, the terminal process shouldn't register it at all (or atleast release it after the corresponding tab/process was closed / navigated away)
claunia added the Issue-BugResolution-Duplicate labels 2026-01-31 05:27:38 +00:00
Author
Owner

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

Thanks for the suggestion! This is actually already being tracked by another issue on our repo - please refer to #5506 for more discussion.

/dup #5506

@zadjii-msft commented on GitHub (Mar 7, 2022): Thanks for the suggestion! This is actually already being tracked by another issue on our repo - please refer to #5506 for more discussion. /dup #5506
Author
Owner

@ghost commented on GitHub (Mar 7, 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 commented on GitHub (Mar 7, 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!
Author
Owner

@Araxeus commented on GitHub (Mar 7, 2022):

Sorry, somehow I didn't find the 4 issues that already exists.

And thank you for your time

@Araxeus commented on GitHub (Mar 7, 2022): Sorry, somehow I didn't find the 4 issues that already exists. And thank you for your time
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#16932