Hi guys, I’m stuck on Stage #XK3
I’m running multi-pipe cmd with grep at the end
for example: ls -la /tmp/quz | tail -n 5 | head -n 3 | grep "f-77"
If there is a row, it will print, if there are no rows detected, it prints nothing
But your tester expects to have “NIL” as output.
❯ codecrafters test
Initiating test run...
⚡ 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::#XK3] Running tests for Stage #XK3 (Pipelines - Multi-command pipelines)
[tester::#XK3] [setup] export PATH=/tmp/mango/apple/raspberry:$PATH
[tester::#XK3] [setup] echo -n "pineapple\nbanana\nmango\nblueberry\napple" > "/tmp/foo/file-87"
[tester::#XK3] Running ./your_program.sh
[your-program] $ cat /tmp/foo/file-87 | head -n 5 | wc
[your-program] 5 5 38
[tester::#XK3] ✓ Received expected output
[tester::#XK3] [setup] echo -n "banana" > "/tmp/quz/f-7"
[tester::#XK3] [setup] echo -n "raspberry" > "/tmp/quz/f-63"
[tester::#XK3] [setup] echo -n "blueberry" > "/tmp/quz/f-98"
[tester::#XK3] [setup] echo -n "apple" > "/tmp/quz/f-85"
[tester::#XK3] [setup] echo -n "strawberry" > "/tmp/quz/f-51"
[tester::#XK3] [setup] echo -n "orange" > "/tmp/quz/f-77"
[your-program] $ ls -la /tmp/quz | tail -n 5 | head -n 3 | grep "f-77"
[your-program] $
[tester::#XK3] Output does not match expected value.
[tester::#XK3] Expected: "NIL"
[tester::#XK3] Received: "$ "
[tester::#XK3] Assertion failed.
[tester::#XK3] Test failed
Also, sometimes I have a crash on same code
for example:
❯ codecrafters test
Initiating test run...
⚡ 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::#XK3] Running tests for Stage #XK3 (Pipelines - Multi-command pipelines)
[tester::#XK3] [setup] export PATH=/tmp/banana/orange/mango:$PATH
[tester::#XK3] [setup] echo -n "blueberry\norange\nstrawberry\nraspberry\nmango" > "/tmp/baz/file-81"
[tester::#XK3] Running ./your_program.sh
[your-program] $ cat /tmp/baz/file-81 | head -n 5 | wc
[your-program] 0 0 0
[tester::#XK3] Output does not match expected value.
[tester::#XK3] Expected: " 5 5 43"
[tester::#XK3] Received: " 0 0 0"
[your-program] $
[tester::#XK3] Assertion failed.
[tester::#XK3] Test failed
It works sometimes, sometimes don’t
Does it relates to tester env? I can’t reproduce this bug
Here is my link to GitHub repo: GitHub - steal9pro/codecrafters-shell-go