I have created an interface that writes output to a shell executable script. I then want to run the shell script from Xojo in the background .
I use Shell.Execute("./myScript \&") doesn’t seem to work. I have also added & to the end of the command line in the script, but this doesn’t work either.
What is the best way to execute a bash script
Check the error from Shell, I’d bet it can’t find the script based on the partial path.
Also, you’ll want to the set the Shell Mode to Asynchronous.
Yes using Asynchronus and the script is in the same folder as my Xojo App hence the partial path.
shell is not a terminal and partial paths are frequently not interpreted correctly
use a full path to it and see if that changes things
If you are using mode = 2, then you need to wait to let the command finish:
theShell.Mode = 2
Loop Until Not theShell.IsRunning
If theShell.ErrorCode <> 0 Then
MsgBox "Shell Error" + EndOfLine + EndOfLine + theShell.ReadAll
// ... do what you do when the command completes