The TERMINAL is NOT the same thing as a SHELL object - you CAN’T expect the results from TERMINAL to be the same as what you get out of a SHELL object.
Edit: there wasn’t really a question. Are you trying to get which to work in a Shell object, or are you trying to use jazzy in a Shell object?
exactly… I need to know if a user has Jazzy installed or not…
FYI… my above example works fine if I use any other macOS command, or if I specify the path to where Jazzy is (which of course defeats the purpose)
But after further research I found that Jazzy should by default be installed in /usr/local/bin
so for my purposes I will check there, and if not leave it up to the user to move things
or perhaps I’ll provide an option to change the “default” search location
Hi Dave (and anyone who stumbles onto this in the future):
The ELI5 explanation of what’s going on is this: When you open a terminal, it fires up a session in your $SHELL of choice. On OS X, this is usually /bin/bash, and bash comes with a set of pre-defined paths already set up by default, including /usr/local/bin/
A shell object in Xojo does not fire up a bash session, so you don’t get all the same paths loaded that you do in terminal. Since the which command searches the current path to see where the requested executable lives, you need to have the same paths set up to get the same result. This is why it is not working in the Xojo shell - it’s not running a bash shell under the hood.
However, you can run a command through bash in a Xojo shell, and get the same paths loaded that way. What happens when you try this?
Dim sh As New shell
sh.Execute "/bin/bash -lc ""which jazzy"""
MsgBox sh.Result