-
Notifications
You must be signed in to change notification settings - Fork 149
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
Replace command
with which
in tool_exists
#192
base: main
Are you sure you want to change the base?
Conversation
It's fine for it to return nil when the command is not found. It's falsy. |
Sorry but It seems not ok to me |
I don't understand the concern you're raising:
|
'command' is a shell (sh) command Instead 'which' is an external command, often installed at system level (is an executable in PATH) in both Linux, Windows etc |
Ah, I see. So you're hitting this problem running it in a Windows shell? Does the rest of everything work otherwise? We typically don't spend much/any time on compatibility with Windows shell, since WSL offers a much easier road to compatibility. Or is there another shell where this is manifesting itself? |
>> system "command -v yarn > /dev/null"
=> true as opposed to trying to find a file to execute: >> system "command -v yarn", exception: true
(irb):1:in `system': No such file or directory - command (Errno::ENOENT)
https://rubyapi.org/3.3/o/kernel#method-i-system I think https://unix.stackexchange.com/questions/85249/why-not-use-which-what-to-use-then |
command
is a built-in shell command in linux (at least in debian , ubuntu and similars)If executed in ruby system it return nil (inspecting: 127 command not found)
This not happens with
which
, that is a system command.I 've done a PR for fast, but if you prefer I can open a simple issue. 🙂
TY