Locate executable files

the my_exe external command has random executable in the tester. it is not the same as the one i got from the system path, so the test kept failing

1 Like

How do you solve the problem

what’s happen to those my_exe command?, i’t’s randomly selected path yet when I got lucky the result is still failed? :

remote: [your-program] $ type my_exe

remote: [your-program] my_exe is /tmp/quz/my_exe

remote: [tester::#MG5] ^ Line does not match expected value.

remote: [tester::#MG5] Expected: “my_exe is /tmp/qux/my_exe”

remote: [tester::#MG5] Received: “my_exe is /tmp/quz/my_exe”

remote: [your-program] $

remote: [tester::#MG5] Assertion failed.

remote: [tester::#MG5] Test failed

Hey @Yeabsirashimelis @maulana48, could you double-check if your code implements the following logic?

Note that there are multiple files with the same name in different locations, but not all of them are executable. Only the first executable should be picked up.

As for the randomness, it’s there to prevent hardcoded solutions from passing, and isn’t related to the issue you’re encountering.

You got me there, it’s missing the permission check, I still don’t understand why when expected and received message is same it’s failed though, thanks for your help

1 Like

I still don’t understand why when expected and received message is same it’s failed though

@maulana48 Possibly because qux and quz are easy to mix up?

It was such a great response from you. it works directly when I correct the code exactly as you said.
I wasn’t checking the files executing permissions

1 Like

Not sure if your doubt is on why this is failing, but here is why. You where not lucky, paths are different, you returned the path where there is a ‘my_exe’ but that one is not executable.

“my_exe is /tmp/qux/my_exe” → qux

“my_exe is /tmp/quz/my_exe” → quz

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