I can't cd after I removed a sub-folder!?
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 14.4k
- Forks
- 756
- PR merge metrics
- No merged PRs in 30d
Description
Node version (or tell us if you're using electron or some other framework): 12.18
ShellJS version (the most recent version/Github branch you see the bug on): 0.8.4
Operating system: Linux
Description of the bug:
When I'm in the folder (via cd) that I want to remove and I executed the shell.rm() the folder. like /tmp/testfolder. I can't change the directory towards that root-folder, so in this case: shell.cd('/tmp') won't work anymore!?
Error I would get it:
cd: not a directory: /tmp
at Object.error (/path_to_project/node_modules/shelljs/src/common.js:110:27)
at Object._cd (/path_to_project/node_modules/shelljs/src/cd.js:35:21)
at Object.cd (/path_to_project/node_modules/shelljs/src/common.js:384:25)
Yes, the /tmp folder still exists! So I'm 100% sure that folder is NOT removed.
Example ShellJS command to reproduce the error:
shell.cd('/tmp/a')
shell.rm('-rf', '/tmp/a')
shell.cd('/tmp')
Please, help!?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Inspect src/cd.js and src/common.js, especially the paths shown in the stack trace. Run the supplied reproduction on Linux to observe the behavior after removing the current directory. Done means the final shell.cd('/tmp') behaves correctly, with a regression test covering the sequence.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100