From: brabuhr@... Date: 2010-06-17T07:53:18+09:00 Subject: Re: Simulating keystrokes for automated user input On Wed, Jun 16, 2010 at 6:34 PM, Ryan Mohr wrote: > Brian Candler wrote >> Otherwise, perhaps you can explain what you are trying to achieve? > > In addition to the CLI, I'm developing a simple gui interface.  As the > user interacts with the gui, commands are sent back to the CLI through a > socket connection. > > At this point my CLI has nearly 100 commands and growing, so the easiest > approach would be for the GUI to just send the text command desired and > have it "typed" into the main app. In the GUI program run the CLI via PTY.spawn and let the GUI program write ("type") commands (directly) to the CLI (instead of using a socket). If the GUI and CLI must run on separate hosts, launch the CLI remotely via, for example, Net::SSH. As a third alternative write a small helper program to run on the server, it will run the actual CLI via PTY.spawn and listen on the socket for connections from the GUI.