phyver / GameShell

a game to learn (or teach) how to use standard commands in a Unix shell
GNU General Public License v3.0
2.17k stars 138 forks source link

`gsh reset` error `getcwd: cannot access parent directories` #57

Closed duthils closed 3 years ago

duthils commented 3 years ago

Scenario

Given I start mission 4 Given I create a Hut inside the Forest Given I go to the Hut Given I create a Chest inside the Hut When I enter gsh reset Then I see errors:

shell-init: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory                                                                                                 
chdir: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
...

Expected: mission 4 is reset

Here is the list of commands:

cd Forest/
mkdir Hut
cd Hut
mkdir Chest
gsh reset

Environment

phyver commented 3 years ago

Good catch. The gsh reset was removing the Hut / Chest you had created.

b2fec226 should fix this.

I now check $PWD doesn't contain the Hut / Chest. If it does, I cd ~ before removing the Hut / Chest.