Execute versus launch

I have a small executable that I call from Xojo. If I start it using shell.execute, it runs as expected. However, if I start it with folderitem.launch, it opens the terminal window.

Is this behavior something I can control from within my app, or is it within Xojo? What I need is to launch without any terminal window.

Use shell. Launch opens the default app to execute, which happens to be terminal.

My problem is that I do not believe that shell is acceptable in the App Store.

Pardon me, James, but this is absolutely not the case. It is a urban legend.

I have a two apps in the App Store that are wrappers of shell commands, and I use out of the box Xojo shell.

However, if you need to launch a console helper, it is different. Sandbox will not let you do it with the regular shell.

But I see you participated in https://forum.xojo.com/12479-helper-apps-and-the-sandbox/0

MBS has plugins to launch an app with the sanctioned API under sandbox. Check LaunchServicesFindApplicationForInfoMBS()

thank you michel for your answer. perhaps since you have been successful at this, you can help me understand the results i get.

  1. if i compile and sandbox using shells, the resulting executable crashes. the console reports:

11/30/16 1:25:12.211 PM sandboxd[138]: ([26055]) bash(26055) deny process-exec*

  1. if i launch with LaunchServicesOpenMBS, i get the same 49 terminal windows i get with plain launch.

Sure. If you follow the thread I linked to again, I had the same result. Regular shell cannot launch a console helper when sandboxed.

Yes, I use LaunchServicesOpenMBS to actually launch the app, so I had the reverse use.

Sam Rowlands mentioned several times the NSTask API call that should be used for shell under sandbox.

MBS has this : http://www.monkeybreadsoftware.net/example-cocoa-nstask.shtml

After several days of testing , and much patient support from Christian (when you get mail from him saying “try something like,” you know you are about to get the definitive answer) I believe the approach for launching executables in sandboxed apps is indeed:

  1. Put the executable in MacOS in the app bundle.
  2. Use NSTask. It seems to do everything needed.