Console and web as single icon Mac app?

Does anyone know how (if even possible) to turn a console app and/or a standalone web app on MacOS X into a single icon application, like we have for MacOS X desktop apps? Say, can you embed a console app inside a Mac desktop app?!

Build the console app & put it inside the Desktop App’s bundle - Apple has a specific recommended place for them now

Sign etc as appropriate

Do you mean that I put the console app (plus Libs and Resources folders) inside the Contents>MacOS folder inside the package? I tried that and the desktop app just quit!

If I place the Console app into a different folder in the package, where is the best location to store it and how might you launch it (i.e. to keep Apple happy!) e.g. by shell?

Then what? Would you loop in the desktop app checking that the Console app is still running, then quit if it’s not?

https://developer.apple.com/library/mac/technotes/tn2206/_index.html

read about helper apps.

you can launch for example with the shell class.
It depends of course whether you are sandboxes or not.

Thank you. It makes sense for the console app to be treated like a Helper app.

I do this with a couple of apps. If the command line args match a specified pattern, I run the helper app as if started from the command line. Otherwise, I let the App.Open go through the normal GUI startup. The secret is to set default window to none and wait for the shell.IsRunning state to go false (indicating that the helper has finished).

That makes sense re Shell.IsRunning, thanks Tim.

Thx too!

A couple of things to note:

#1 your helper application must be in one of the following folders “MacOS”, “Helpers”, “Frameworks”, “Plugins” or the correct “Library” subfolder. Otherwise code signing can fail.

#2 If you intend to sell this app via the Mac App Store, you must use NSTask to control the console application, the Xojo Shell class will not cut it.

And I learned this the hard way.

Haven’t used Shell for MAS Apps. Is then NSTask required?

Looks like it’s required.

(NSTaskMBS via MBS Plugin)

[quote=168181:@Sam Rowlands]
#2 If you intend to sell this app via the Mac App Store, you must use NSTask to control the console application, the Xojo Shell class will not cut it.[/quote]

Could you elaborate ? I have two apps which wrap command line that use shell to do that and have been in the MAS for a year…

I remember reading a forum post were you told you were using Shell for a MAS App. Maybe the kind of commands sent to shell, then?

Since I have been selling those two apps to many happy campers, I just wonder what I should fear, after Sam says the shell class “does not cut it”. He already mentioned NSTask can launch a process so the parent process can end without killing the child. That is interesting but would not change my current apps.

Apparently, Apple does not reject apps that use shell. Otherwise a lot of my apps would have been kicked out.

I just want to know what he meant by “not cut it”, or what Tim means by “I learned this the hard way”. What happened exactly ?

[quote=168475:@Michel Bujardet]Since I have been selling those two apps to many happy campers, I just wonder what I should fear, after Sam says the shell class “does not cut it”. He already mentioned NSTask can launch a process so the parent process can end without killing the child. That is interesting but would not change my current apps.

Apparently, Apple does not reject apps that use shell. Otherwise a lot of my apps would have been kicked out.

I just want to know what he meant by “not cut it”, or what Tim means by “I learned this the hard way”. What happened exactly ?[/quote]

I wish I could explained as you do. It’s exactly what I am really asking, Michel.

I am using very plain shell code, really, nothing extraordinary. What do you want to know ?

Your programs uses Shells and pass MAS approvals and I understood that NSTask is a need for MAS Apps. I still has not sent any MAS app with shell needs, and knowing the time it takes for reviewing, know if this could be something relating to just Xojo Shell ( any use is not accepted by reviewers or we need to substitute Shell for NSTaskl for any single command send to shell).

Again, can’t edit…