Re: Opening an Embedded Application in Terminal
Re: Opening an Embedded Application in Terminal
- Subject: Re: Opening an Embedded Application in Terminal
- From: Keary Suska <email@hidden>
- Date: Sun, 07 Dec 2014 14:42:18 -1000
On Dec 7, 2014, at 1:35 PM, SevenBits <email@hidden> wrote:
>>
>> I don't know if this approach is more likely to work in a sandboxed app. I doubt it, because it would be an enormous hole in the sandbox. If you can direct Terminal to run arbitrary commands, what protection does the sandbox provide?
>
> I get your point, but the fact is, I’m not trying to run an arbitrary command, and I don’t even care if Terminal inherits the sandbox from my process. I just need to run this command in a window so that the user can type input in and receive the results back. In other words, I’m looking for Terminal’s user interface, not its ability to run arbitrary commands.
>
> If it matters, the executable is a program that evaluates instructions using REPL (read-eval-print loop).
>
>>
>>
>>> I really need this to work as it’s an important aspect of my application. Can anyone advise?
>>
>> I suspect you have a serious problem, then. You will probably need to deploy outside of the Mac App Store so that you don't have to sandbox your app. Alternatively, you can build a terminal emulator UI into your app and run the embedded console program within that, instead of Terminal. Depending on the needs of your console program, that may be a relatively straightforward prospect or a very complex one.
>
> Well, I’m stuck in the middle. On the one hand, implementing a full-brown terminal emulator along the lines of iTerms 2 for my app is overkill and isn’t worth the extra megabytes. But I don’t want to implement a kludgy NSTextField-based interface to feed in input using NSTask and output/input streams either, as it doesn’t look that great.
>
> However, unless someone can come up with a good way to provide a Terminal-like environment for REPL applications, the second approach is the one I’ll probably have to take…
I would first try NSTextView instead--you get a lot of control simply from delegate calls, although you will need to subclass. The only tricky part is how to handle the parts that would not be editable, and what to do when someone tries to edit it. Setting a custom attribute is probably the way to go.
HTH,
Keary Suska
Esoteritech, Inc.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden