Re: NSTask send commands via standardInput
Re: NSTask send commands via standardInput
- Subject: Re: NSTask send commands via standardInput
- From: Andrew Farmer <email@hidden>
- Date: Sat, 27 Nov 2004 13:47:03 -0800
On 27 Nov 2004, at 13:33, René Korthaus wrote:
On 27 Nov 2004, at 12:58, René Korthaus wrote:
i am running an NSTask and while running i want to send commands to
this task. I now googled half a day and only found this code:
NSString * commandString = [commandField stringValue]; // this is
my command
/* this is what i found on the web */
NSData * commandToSend = [commandString
dataUsingEncoding:NSUTF8StringEncoding];
[[[qemu standardInput] fileHandleForWriting]
writeData:commandToSend];
I have a NSTextView where i see the output of the task, but when i
send, lets say quit via the commandField (NSTextField), nothing
happens to my task and the output says
"q[K[Dqu[K[D[Dqui[K[D[D[Dquit[K". That's with all commands
i pass to the task.
Looks like the program in question uses readline or something to
parse input. You may want to check to see if there's an option to
turn this off.
What's the program?
It's qemu (http://www.qemu.com), cpu emulator.
You're right, it should use readline, cause there is a readline.c in
the cvs directory
(http://savannah.nongnu.org/cgi-bin/viewcvs/qemu/qemu/readline.c). But
isnt there a method to undergo this without modifying qemu? I do not
know what readline is, can you help me?
Readline is a terminal library used to add 'history' and command-line
editing to programs. It's not - as you've discovered - especially
friendly to anything other than a terminal, though. The easiest way to
deal with this would probably be to delete everything preceding a
"\e[D", then delete all "\e[" sequences (including the following
character).
Also note that writing a newline ('\n') at the end of the command might
help....
Attachment:
PGP.sig
Description: This is a digitally signed message part
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden