Skip to content

Harden code against mocks/stubs #8

@Flamefire

Description

@Flamefire

The code uses e.g cat which may be mocked/stubbed by the user and point to something else.

I'd suggest to get the real locations on startup (e.g. command -v cat or which cat) and save them for later use.

Alternative:

During startup (global scope): _BATSLIB_PATH="$PATH"
Call site: PATH="$_BATSLIB_PATH" \cat -

This resets the path and avoids macro/alias expansion

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions