alex2k8
alex2k8

Reputation: 43214

Control IRB through a named pipe (instead of STDIN/STDOUT)

Is it possible to run Ruby IRB ver a named pipe, so I can send commands and get results remotely?

Generally I would like to utilize the IRB engine, while have a different UI (probably written with .Net).

Upvotes: 2

Views: 734

Answers (2)

MarkusQ
MarkusQ

Reputation: 21950

It seems to be (I just tried it); just pipe the I/O through your named ppipe and you're good.

But I gotta ask, why?

Specifically, why don't you just run it as a subprocess?

Upvotes: 1

dstnbrkr
dstnbrkr

Reputation: 4335

I believe so - this worked for me (mac os x):

in terminal 1:

mkfifo rpipe

in terminal 2:

tail -f rpipe | irb

in terminal 1:

echo "puts 'hi'" > rpipe

in terminal 2 (output):

puts 'hi'
hi
nil

Kinda annoying that the original command is output as well, but close...

Upvotes: 2

Related Questions