#UN3 | Error final stage test | Go

I’m stuck on the last stage with this test error output:

remote: [tester::#UN3] Running tests for Stage #UN3 (Redirection - Append stderr)
remote: [tester::#UN3] Running ./your_program.sh
remote: [tester::#UN3] Writing file "/tmp/quz/apple" with content "apple"
remote: [tester::#UN3] Writing file "/tmp/quz/blueberry" with content "blueberry"
remote: [tester::#UN3] Writing file "/tmp/quz/grape" with content "grape"
remote: [your-program] $ ls -1 nonexistent >> /tmp/foo/baz.md
remote: [tester::#UN3] Failed to read file ("/tmp/foo/baz.md"): open /tmp/foo/baz.md: no such file or directory
remote: [your-program] ls: nonexistent: 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)

The test run with debug: true gives the same output as above. The same code, when i run it locally gives me the expected output:

$ ls nonexistent >> ./temp
ls: cannot access 'nonexistent': No such file or directory
$ ls -1 nonexistent >> ./temp
ls: cannot access 'nonexistent': No such file or directory
$ 

Is this a bug in my code or in the test? GitHub - giacomo-folli/codecrafters-shell

I’ll take a look and try to get back to you by early next week.

1 Like

Hi @giacomo-folli, the expected behavior is to create the target file (/tmp/foo/baz.md) even if the main command fails.

Here’s an example from zsh on my machine for reference:

1 Like

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.