Skip to content

Use dir .. for shell detection on Windows instead of uname -s#240

Open
GilgameshxZero wants to merge 1 commit intojeanp413:masterfrom
GilgameshxZero:pr
Open

Use dir .. for shell detection on Windows instead of uname -s#240
GilgameshxZero wants to merge 1 commit intojeanp413:masterfrom
GilgameshxZero:pr

Conversation

@GilgameshxZero
Copy link

Addresses the issue raised in #164 by updating how shell detection is performed on Windows.

dir has demonstrable differences between its invocations in powershell, cmd, and (git) bash, except on an empty directory. .. is likely non-empty, except in weird permissions/home directory scenarios.

Another edge case which remains untested is that of different locales. I tried setting both system and user locales to es-MX but could not get a response in powershell/cmd that was not in English.

Below are samples of dir .. on powershell, cmd, and bash.

powershell:

    Directory: C:\Users


Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
d-----        11/19/2025   5:12 PM                0
d-r---         1/18/2025   5:11 PM                Public

cmd:

 Volume in drive C has no label.
 Volume Serial Number is ECAB-EE57

 Directory of C:\Users

02/16/2025  08:05 PM    <DIR>          .
11/19/2025  05:12 PM    <DIR>          0
01/18/2025  05:11 PM    <DIR>          Public
               0 File(s)              0 bytes
               3 Dir(s)  908,322,545,664 bytes free

bash:

0  All\ Users  Default  Default\ User  desktop.ini  Public

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant