I’m stuck on Stage #ei0.
I implemented the earlier stages and in stage IP1 I used a rust Command. I think this may be “cheating” kind of since I can pass anything to the shell now and the Command will process it. See my code below.
The weird thing is that I can’t pass stage ei0 even though locally I get the behaviour as explained by the instructions.
Here are my logs:
remote: Running tests on your code. Logs should appear shortly...
remote:
remote: [compile] Compiling codecrafters-shell v0.1.0 (/app)
remote: [compile] Finished `release` profile [optimized] target(s) in 1.21s
remote: [compile] Moved ./.codecrafters/run.sh → ./your_program.sh
remote: [compile] Compilation successful.
remote:
remote: Debug = true
remote:
remote: [tester::#EI0] Running tests for Stage #EI0 (Navigation - The pwd builtin)
remote: [tester::#EI0] Running ./your_program.sh
remote: [your-program] $ type pwd
remote: [your-program] pwd is a shell builtin
remote: [tester::#EI0] ✓ Received expected response
remote: [your-program] $ pwd
[your-program] pwd: command not found: No such file or directory (os error 2)
remote: [tester::#EI0] Output does not match expected value.
remote: [tester::#EI0] Expected: "/app"
remote: [tester::#EI0] Received: "pwd: command not found"
remote: [your-program] $
remote: [tester::#EI0] Assertion failed.
remote: [tester::#EI0] Test failed
remote:
remote: Try our CLI to run tests faster without Git: https://codecrafters.io/cli
remote:
remote: View our article on debugging test failures: https://codecrafters.io/debug
remote:
And here’s a snippet of my code:
The full link is here
_ => {
let output = Command::new(command).args(args).output();
match output {
Ok(output) => {
if !output.stdout.is_empty() {
print!("{}", String::from_utf8_lossy(&output.stdout));
}
if !output.stderr.is_empty() {
eprint!("{}", String::from_utf8_lossy(&output.stderr));
}
}
Err(_err) => println!("{}: command not found: {}", command, _err.to_string()),
}
}
Here’s my output:
vscode ➜ /workspaces/codecrafters-shell-rust (master) $ ./your_program.sh
Finished `release` profile [optimized] target(s) in 0.02s
$ pwd
/workspaces/codecrafters-shell-rust
$ type pwd
pwd is a shell builtin
Any ideas? Thanks!