I’m stuck on Stage #qp2.
I’m getting an error on a test that I don’t quite understand why the error occurs.
Primarily because I can’t reproduce the error locally. But also, the error message indicates that the stdout append redirect can’t open a file, which the append redirect should create if not already existing given that the enclosing directory exists.
Output from test:
remote: [tester::#UN3] Running tests for Stage #UN3 (Redirection - Append stderr)
remote: [tester::#UN3] [setup] export PATH=/tmp/banana/grape/banana:$PATH
remote: [tester::#UN3] Running ./your_program.sh
remote: [your-program] $ ls -1 nonexistent >> /tmp/quz/baz.md
remote: [tester::#UN3] Failed to read file ("/tmp/quz/baz.md"): open /tmp/quz/baz.md: no such file or directory
remote: [your-program]
remote: [tester::#UN3] Assertion failed.
remote: [tester::#UN3] Test failed (try setting 'debug: true' in your codecrafters.yml to see more details)
Output when testing my shell locally (as expected, stderr is not redirected, since this command redirects stdout):
./your_program.sh
$ ls -1 nonexistent >> /tmp/quz/baz.md
ls: nonexistent: No such file or directory
$ ls /tmp/quz/
baz.md
$ cat /tmp/quz/baz.md
$
I am primarily testing by git push, in case that information is relevant.
Hey @TrulsElg, I tried running your code against the previous stages, but it’s actually no longer passing a previous stage #CZ2 (Handle invalid commands).
Thanks for the feedback @andy1li
I’m not sure if I’ve set up the codecrafters CLI wrong somehow but the test is failing to compile my code, which seems strange to me as the code does compile locally.
The output states that there’s a missing entry for the term package, but it’s there in the file.
[compile] cmd/myshell/main.go:5:2: missing go.sum entry for module providing package golang.org/x/term; to add:
[compile] go mod download golang.org/x/term
[compile] Looks like your code failed to compile.
[compile] If you think this is a CodeCrafters error, please let us know at hello@codecrafters.io.
Setting debug: true in the yml file gives no additional output.
@andy1li As you pointed out, handling both CR and LF needed to happen and I was only handling CR.
Updating to handle both in the same switch case sorted out the failing test.
Thanks a bunch for your support!