mathisonian / mathisonian/command-exists

Failing to determine 'cd' alone as a command in Windows

Open
#30 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
147
Forks
22
PR merge metrics
No merged PRs in 30d

Description

The module is failing to determine 'cd' (without parameters) as a command in windows.
```
var commandExistsSync = require('command-exists').sync;
var cmd = 'cd';
console.log("Check for cd : "+ commandExistsSync(cmd));
```

Output in Windows (Node v6.17.1) :

> Check for cd: false

But, [cd](https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/cd#:~:text=In%20this%20article&text=Displays%20the%20name%20of%20the,the%20current%20drive%20and%20directory.) is indeed a valid command which when used without any parameters displays the current drive and directory. Whereas, other standalone commands such as `dir, pwd, ls.`. tends to be recognized as valid commands.

Tested and observed this behavior on recent version of node (v14.15.0) and older versions as well ( v6.17.1 , v8.17.0 and v12.13.0).

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the command-exists sync example on Windows with Node, then inspect the command lookup path used for built-in commands. Done means cd without parameters is recognized as available on Windows, while existing checks such as dir, pwd, and ls continue to work.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
cli, operating-systems
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
40/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.