(Zig) "Build your own shell" - stage "The Type builtin executable"

Discovered while running “Run a program stage”.
The test runners’ type cat :smiley_cat: is getting failed, when I run the same on my machine it’s always generating expected output as below:

I’m using yours git repo: [censored]

I tried all my debug avenues but availed no success, any help in this regard is appreciated :pray:

Regards
~Hamed

Hi @rite2hamed, I can barely read Zig.

The code currently fails at stage #MG5, but it successfully passed earlier. Could you check out the last successful version and compare what might have gone wrong?

git checkout bdd10f3e33c01d7524b50c215bdd91090927a2d2

I refactored my code, does your test harness needs an elevated permissions, it doesn’t seem to find /bin/cat (from my screen shot)

On my machine it’s printing as expected cat is /bin/cat (from my screen shot)

does your test harness needs an elevated permissions,

In short, no.

It’s likely that your refactor introduced an unintended bug, as the previous commit (bdd10f3e33c01d7524b50c215bdd91090927a2d2) passed successfully.


In fact, the refactor is actually no longer passing the second stage #CZ2 (Handle invalid commands).

Suggestions:

  1. Use our CLI to test against previous stages by running:
codecrafters test --previous
  1. Focus on fixing the early stages first, as later stages depend on them.
1 Like

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