Re: Sending keycode to stdin
Re: Sending keycode to stdin
- Subject: Re: Sending keycode to stdin
- From: Andrew Farmer <email@hidden>
- Date: Fri, 22 May 2009 21:30:41 -0700
On 22 May 2009, at 15:54, Marc Tecles wrote:
i'm trying to write a Cocoa application that launch a command line
tool for example top. I've used NSTask with 2 NSPipe to launch the
command line tool and to redirect the stdout and stderr to an
NSTextview in my applycation asynchronously with Notification center.
Now i want to send to the top application the keycode corresponding
to the keyboard Q to terminate the task. I tried to write to the
stdin without success.
Do you have any idea how to send key code to a command line tool
launch with NSTask ?
(Quick reminder: command line tools take strings of characters as
input, not keycodes.)
Unfortunately, top doesn't accept keyboard input when it isn't
attached to a terminal. Your best bet is to just kill() the child
process. (The alternative is creating a pty, which involves all sorts
of painful issues like parsing VT100 control sequences.)
_______________________________________________
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