Reputation: 3545
I want to look if cmake
is installed in my system with Raku.
cmake --version
at my command line gives:
cmake version 3.23.0
CMake suite maintained and supported by Kitware (kitware.com/cmake).
One way I know (not sure if it is right or there are better ways) is:
my $cmake = shell('cmake --version').exitcode;
die "Aborting !, cmake installation is not present,
Install and try again," if $cmake != 0;
Is it a right way? Are there other better ways to handle it?
Its quite a generic question, it can help to test any other program.
Upvotes: 5
Views: 134
Reputation: 23517
Well, I'd probably use something like this, which does not depend on a specific command line argument
die unless shell "which @*ARGS[0]";
It will print the path if it finds it, die if it does not. But if your script works for you, there is more than one way to do it.
Upvotes: 1