I am evaluating Xojo for a project which should allow me to interact with the terminal in Mac OSX. When I fire the Mac built-in terminal i can type, for instance, “cordova -v” and get the version of the installed Cordova package on my machine.
However, with the Shell feature of Xojo, I am able only to execute built-in commands, such as ls, cd, etc. but not others like android, npm, cordova, etc. that is packages which I installed.
Is Shell limited to built-in commands of the operative system? What I am trying is the first example at this url http://documentation.xojo.com/index.php/Shell replacing ls -la with cordova -v
Thank you very much for your support and happy Easter to all!
I just tried /usr/local/bin/cordova -v with success with the Mac terminal. Still, with Xojo, same command, I get a 127 error, which means no file found or it was impossible to run the command.
I just tried /usr/local/bin/cordova -v with success with the Mac terminal. Still, with Xojo, same command, I get a 127 error, which means no file found or it was impossible to run the command.
Any idea?
Thanks again[/quote]
Check the path on everything. The Shell object is not the same as a terminal in that the environment is not the same. You can see this by executing the env command in the terminal and from within the shell.
Note: this is true of every programming language, not just Xojo. A system shell is never the same as a terminal window. On any OS, on any programming language. Just FYI.
[code]Dim s As New Shell
Dim cmd As String
#If TargetMacOS Or TargetLinux Then
cmd = "/bin/bash/cordova -v"
#Elseif TargetWin32 Then
cmd = "set"
#Endif
s.Execute(cmd)
If s.ErrorCode=0 Then
TextArea1.Text = s.Result
Else
TextArea1.Text = "Error " + Str(s.ErrorCode)
End If[/code]
Also tried /usr/local/bin/cordova -v with no luck.
How? Well, first it was /usr/local/bin/cordova -v than it didn’t work and I used the other one. Both work from terminal. No idea how to start Cordova from a system shell.
Cordova is probably using an environment variable that is not set in the Shell. You might want to write a batch script that sets up the environment and then calls cordova. Execute that in the shell.