Skip to main content

command_on_path

Function command_on_path 

Source
pub fn command_on_path(cmd: &str) -> bool
Expand description

What: Determine whether a command is available on the Unix PATH.

Inputs:

  • cmd: Program basename or path containing a path separator.

Output:

  • true when an executable file is found with the executable bit set.

Details:

  • Honours Unix permission bits so a non-executable file on PATH is not treated as a tool.
  • Ported from Pacsea’s install/utils.rs.