V
Victor Reyes
[Note: parts of this message were removed to make it a legal post.]
Hello Team,
I wrote the simple piece of code below which under "normal" circumstances it
works fine.
If, however, the command executed generates an error msg, the error is
displayed on the screen.
This is a behaviour which I don't want.
I would like to capture ALL output generated by the command and return it to
the caller.
I tried different tricks but nothing worked. The question is:
How can I capture ALL output from line: *userCMD_output = `#{input}`*
including stderr???
require 'socket'
port = 19557
server = TCPServer.new("", port)
while (session = server.accept)
input = session.gets
userCMD_output = `#{input}`
session.write("#{userCMD_output}")
session.close
end
while you are at it, is there any way to obtain the caller's hostname or IP
address?
Thank you
Victor
Hello Team,
I wrote the simple piece of code below which under "normal" circumstances it
works fine.
If, however, the command executed generates an error msg, the error is
displayed on the screen.
This is a behaviour which I don't want.
I would like to capture ALL output generated by the command and return it to
the caller.
I tried different tricks but nothing worked. The question is:
How can I capture ALL output from line: *userCMD_output = `#{input}`*
including stderr???
require 'socket'
port = 19557
server = TCPServer.new("", port)
while (session = server.accept)
input = session.gets
userCMD_output = `#{input}`
session.write("#{userCMD_output}")
session.close
end
while you are at it, is there any way to obtain the caller's hostname or IP
address?
Thank you
Victor