Interactive Commands

J

João Santos

Hey

So im trying to write an irc bot for my clan but mostly just to train
my ruby skills a bit more.
Anyhow some of the functions of the bot require to execute commands on
the server itself, managed to do fine using the backticks but every now
and then the bot just hangs because sometimes when deleting files, ie,
the OS asks for permission and waits for user input ... and it just
hangs there waiting.
Is there anyway to hack across this ?
I've tried open3 and open4 but the also hang when i request the stdout
of the command.
The ideal would be to have full control of output and input via IRC :x

Thanks
 
R

Robert Klemme

Anyhow some of the functions of the bot require to execute commands on
the server itself, managed to do fine using the backticks but every now
and then the bot just hangs because sometimes when deleting files, ie,
the OS asks for permission and waits for user input ... and it just
hangs there waiting.

Why do you need an external process to delete files?
Is there anyway to hack across this ?
I've tried open3 and open4 but the also hang when i request the stdout
of the command.
The ideal would be to have full control of output and input via IRC :x

Well, then you need one of the popen variants and need to read the
command's output, detect that it needs input and handle that accordingly
(e.g. forward it to a client).

Kind regards

robert
 
J

João Santos

Robert said:
Why do you need an external process to delete files?

Its just an example, what i want is to execute system commands even
those who wait for user input. Doesnt really matter if it is over IRC i
cant run a command under ruby which requires input without making the
whole script hang.
Well, then you need one of the popen variants and need to read the
command's output, detect that it needs input and handle that accordingly
(e.g. forward it to a client).

Kind regards

robert

Can you point me which one ? Or to some documentation on popen, i havent
found any decent documentation on popen3 or popen4, i've been following
examples and trial'n'error basically
 

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

Forum statistics

Threads
473,997
Messages
2,570,240
Members
46,830
Latest member
HeleneMull

Latest Threads

Top