Build your own Shell stage The type builtin: executable files #mg5

For this stage the first request is always “type cat” which is expected to be found at “/usr/bin/cat”, however it always triggers at “/bin/cat” (/bin is first in collection) and fails the test.
If I manually prevent “/bin” to be used then system works correctly and goes to “/usr/bin/cat”.
Do I have two cats :cat2: or doing something wrong? :slight_smile:

Yeah, apparently our test runner has two cats :cat:, and it’s getting a cat from the wrong path.

To find out what’s happening, I tried to log out the values of PATH and storage:

@ConstantineRam Turns out storage was a reversed list of what should’ve been. I believe the culprit is:

while ((pos = str.find_last_of(divider)) != std::string::npos)

1 Like

Oh, makes sense and if we keep two cats inside initial list second cat never pops, only if list runs in reverse. Nice!

1 Like

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