create a shell within an app

R

Rahul Kumar

I have a client application - often i am needing to explore/inspect the
classes that I get from the server. Loading the client each time with a
logger.debug statement is cumbersome and takes time due to server
connections and getting data.

I'd like to be able to expose the insides of the client to a shell
(could be inside the client) or could connect to the client. It's an
ncurses app, I can always prompt the user on clicking some key.

However, my query is: how does one expose the environment to this shell.
On the prompt given, I should be able to query objects just as in irb.
e.g

Alternatively, is there already some existing gem which allows me to
expose the internals to a port, so another irb-like client can connect
and query the state ?
thx, rkumar
 
R

Robert Klemme

I have a client application - often i am needing to explore/inspect the
classes that I get from the server. Loading the client each time with a
logger.debug statement is cumbersome and takes time due to server
connections and getting data.

I'd like to be able to expose the insides of the client to a shell
(could be inside the client) or could connect to the client. It's an
ncurses app, I can always prompt the user on clicking some key.

However, my query is: how does one expose the environment to this shell.
On the prompt given, I should be able to query objects just as in irb.
e.g

IIRC you can embed IRC pretty easily. The issue then might be how you
limit access to areas of your application that should stay unchanged.
Alternatively, is there already some existing gem which allows me to
expose the internals to a port, so another irb-like client can connect
and query the state ?

You might just listen on some port with TCPServer and implement a
rudimentary command line interface which then can be connected to via
telnet. That shouldn't be too hard. Depends on your requirements for
security though.

Kind regards

robert
 
R

Rahul Kumar

Piyush Ranjan wrote in post #958454:

I did come across both hijack and live-console.
Unfortunately, hijack hangs in 1.9 and my app runs under 1.8 and 1.9.
(The person concerned said in April he would look into 1.9 but seems
nothing has happened since.)

live-console also borks in 1.9. giving an irb encoding error, however, i
commented off a line and now the samples work. So live-console may be
the way to go for now.

Robert, since this is for testing only, and i would disable it
otherwise, so its not an issue.

It would be nice if someone would take up hijack and live-console
seriously and not let it become abandonware. thanks, rkumar.
 
R

Rahul Kumar

live_console has made it very easy for me to plug in a shell (using irb
on another terminal window) into an existing command-line application.

I hope someone will get it functioning with 1.9.x and maintain it.
thanks.
rkumar
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,816
Latest member
SapanaCarpetStudio

Latest Threads

Top