Test Failed with: ./build/shell: not found

I’m stuck on Stage File completion #zv2.

I’ve tried disabling this stage and trying another stage and there I see error that I expect like job not found or something relevant. But shell not found, I don’t know, that feels like something that’s not happening because of something I am doing (or maybe it is). Can you please help me?

I made sure that I haven’t changed the your_program.shfile or other sh files in the code as well.

Here are my logs:

Initiating test run...

⏳ Turbo test runners busy. You are in queue.

Upgrade to skip the wait: https://codecrafters.io/turbo

Running tests on your code. Logs should appear shortly...

[compile] -- Running vcpkg install
[compile] All requested packages are currently installed.
[compile] All requested installations completed successfully in: 9.9 us
[compile] -- Running vcpkg install - done
[compile] -- Configuring done (0.2s)
[compile] -- Generating done (0.0s)
[compile] -- Build files have been written to: /app/build
[compile] [  7%] Building CXX object CMakeFiles/shell.dir/src/core/command.cpp.o
[compile] [ 14%] Building CXX object CMakeFiles/shell.dir/src/core/commandFactory.cpp.o
[compile] [ 21%] Building CXX object CMakeFiles/shell.dir/src/core/commandRegistry.cpp.o
[compile] [ 28%] Building CXX object CMakeFiles/shell.dir/src/core/commands/cd.cpp.o
[compile] [ 35%] Building CXX object CMakeFiles/shell.dir/src/core/commands/cmdexec.cpp.o
[compile] [ 42%] Building CXX object CMakeFiles/shell.dir/src/core/commands/echo.cpp.o
[compile] [ 50%] Building CXX object CMakeFiles/shell.dir/src/core/commands/exit.cpp.o
[compile] [ 57%] Building CXX object CMakeFiles/shell.dir/src/core/commands/history.cpp.o
[compile] [ 64%] Building CXX object CMakeFiles/shell.dir/src/core/commands/pwd.cpp.o
[compile] [ 71%] Building CXX object CMakeFiles/shell.dir/src/core/commands/type.cpp.o
[compile] [ 78%] Building CXX object CMakeFiles/shell.dir/src/core/terminalSettings.cpp.o
[compile] [ 85%] Building CXX object CMakeFiles/shell.dir/src/main.cpp.o
[compile] [ 92%] Building CXX object CMakeFiles/shell.dir/src/utils/commandUtils.cpp.o
[compile] [100%] Linking CXX executable shell
[compile] [100%] Built target shell
[compile] Moved ./.codecrafters/run.sh → ./your_program.sh
[compile] Compilation successful.

Debug = true

[tester::#ZV2] Running tests for Stage #ZV2 (Filename Completion - File completion)
[tester::#ZV2] [working_dir] - raspberry-32.txt
[tester::#ZV2] Running ./your_program.sh
[your-program] /app/your_program.sh: 12: exec: ./build/shell: not found
[tester::#ZV2] ^ Expected prompt ("$ ") but received "/app/your_program.sh: 12: exec: ./build/shell: not found"
[tester::#ZV2] Test failed

View our article on debugging test failures: https://codecrafters.io/debug

Hey @vivekjoshi556, I’ve pushed a fix to your repo. You can run git pull to sync the changes.

Let me know if you still run into any issues.

Hi @andy1li,

Thank you very much that fixed it. I understand the solution you pushed, but can you please help me understand why was it failing for me and working for other? Is it something I am doing?

Sure! Previously, we ran your program from the repo root directory, so relative paths worked fine

In the Filename Completion extension though, the tester runs your program from a different working directory, so those relative paths no longer resolve as expected.

We updated the starter code to handle this, but existing repos weren’t automatically updated, so this wasn’t your fault at all.