Mac Terminal 'object'

DennisBlah

macrumors 6502
Original poster
Dec 5, 2013
485
2
The Netherlands
Is there anyone who knows how I can create a terminal 'object' inside an xCode application?
I can execute an terminal command using NSTask, with /bin/sh as launchPath.

This is working fine.. But.. I'd like to keep that 'session' open.
For example... open a telnet connection, read the outcome, and afterwards depending on the action of a user I'd like to start sending commands to the 'session'

I want to use it to open up a thirdparty CLI tool which opens a sort off 'session' like telnet, and need to put in several commands.

To prevent user faults, I'd like to do this from xCode so the whole CLI is hidden
 

DennisBlah

macrumors 6502
Original poster
Dec 5, 2013
485
2
The Netherlands

DennisBlah

macrumors 6502
Original poster
Dec 5, 2013
485
2
The Netherlands
Hi Chown,

again thanks for your reply tho. I been looking into it, but this is too much hassle
I think I will work with an bash script using expect -> spawn -> expect (for response) -> send (commands)
 

mfram

macrumors 65816
Jan 23, 2010
1,086
161
San Diego, CA USA
If what you're trying to do is open a "telnet" connection and send/receive commands from a program, the real answer is to open a TCP connection to port 23 and then send and receive commands to that socket connection. There's no reason to get an NSTask or Shell or anything else involved.
 

jasnw

macrumors 6502a
Nov 15, 2013
809
839
Seattle Area (NOT! Microsoft)
I agree with the previous poster. I've done something like this using python, not with a GUI interface however, and it was pretty simple to set up. I'd say pasting a GUI on it would be pretty easy (if you know how to do that, which I don't - I'm a CLI sort of bloke).
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.