Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

is_command always return true #261

Closed
CymDeveloppement opened this issue Jul 2, 2024 · 2 comments
Closed

is_command always return true #261

CymDeveloppement opened this issue Jul 2, 2024 · 2 comments
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@CymDeveloppement
Copy link
Member

the new is_command function added in #185 PR always return true.

this test fail :

import { is_command } from \"std\"
        main {
            if is_command(\"cat\") {
                echo \"exist\"
            }

            if is_command(\"this_is_not_command_amber\") {
                echo \"exist\"
            }
        }

the correct implementation is :

$[ -x "\$(command -v {command})" ]$ failed {
        return false
    }
 return true

not

if (unsafe $command -v "{command}" > /dev/null$) {
    return true
}
return false

sorry i don't see this before

@Mte90
Copy link
Member

Mte90 commented Jul 2, 2024

Do you want to do a PR with the fix?

@Mte90 Mte90 added bug Something isn't working good first issue Good for newcomers labels Jul 2, 2024
@CymDeveloppement
Copy link
Member Author

Do you want to do a PR with the fix?

Ok

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants