I’m stuck on Stage #CZ2. I have implemented the correct solution, but my terminal process seems to exit abruptly, which is causing an issue for the tester.
I’ve tried setting my debug value to true in the .yml file, but that hasn’t made a difference.
Here are my logs:
⚡ This is a turbo test run. https://codecrafters.io/turbo
Running tests. Logs should appear shortly...
[compile] Moved ./.codecrafters/run.sh → ./your_program.sh
[compile] Compilation successful.
Debug = true
[tester::#CZ2] Running tests for Stage #CZ2 (Handle missing commands)
[tester::#CZ2] Running ./your_program.sh
[your-program] $
[tester::#CZ2] > nonexistent
[your-program] nonexistent: command not found
[tester::#CZ2] Expected shell to be a long-running process, but it exited
[tester::#CZ2] Test failed
Here is my C code:
#include <stdio.h>
#include <string.h>
int main() {
// Uncomment this block to pass the first stage
printf("$ ");
fflush(stdout);
// Wait for user input
char input[100];
fgets(input, 100, stdin);
input[strlen(input) - 1] = '\0';
printf("%s: command not found", input);
}