Is shell limited to OS' built-in commands?

Hi,

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!

Fabio

You must use the full path for these packages.

Shell is not a terminal. It does not have environment variables like path available.

Thanks Michel

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

post the EXACT code you are using.
you are most likely expressing the path incorrectly

[quote=326314:@Fabio Ricci]Thanks Michel

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.

Thanks Dave and Greg,

my actual code is:

	[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.

Thanks
Fabio

How is it you mention /usr/local/bin/cordova -v in your previous post, and use /bin/bash/cordova -v in your code ?

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.

You get the result of the program in shell.result.

This shows the iconutil command help, as expected :

dim s as new shell s.execute("/usr/bin/iconutil") msgbox s.result

Doing the same will give you more information.

Yes, your code is working. Mine is now:

	[code]dim s as new shell
	s.execute("/usr/local/bin/cordova")
	msgbox s.result[/code]

But still it doesn’t work, as I get env: node: No such file or directory

But at this point I think it does not have to do anymore with Xojo.

Thank you Michel for your time!

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.

bash has a switch for that. Try:

/bin/bash/ --login /usr/local/bin/cordova

Shell does not have access to environment variables like Terminal. What you can do is to set them in the same line you call cordova. For instance

s.Execute("setenv myvar onething && setenv node anotherthing @@ /usr/local/bin/cordova")