If I run with:
input, output, error = Open3.popen3 "nikto -host someip -port 80 -output xml"
How to determine if nikto is complete? It takes some time to complete the scan.
If something goes wrong, I suggest that I should periodically check for errors to see if anything is written?
Are there any decent documents that exist for open3? No, ruby-documents do not fit anywhere.
input, output, error = Open3.popen3 "nikto -host someip -port 80 -output xml" if select([output], nil, nil, 0.1) and output.eof? # process exited and doesn't have output queued. else # still running or has output not read yet. end
Also, here are some good docs I found in googling: http://www.ensta.fr/~diam/ruby/online/ruby-doc-stdlib/libdoc/open3/rdoc/index.html
PID $?
Process.wait $?.pid
a >
, . :
http://en.wikibooks.org/wiki/Ruby_Programming/Running_Multiple_Processes
* nix, SIGCHLD, . , , , .
, IO , EOF , , SIGPIPE, .
Ruby :
Signal.trap("CHLD") do Process.wait $child_died = true end
Open3.popen3(cmd) do |stdin, stdout, stderr, wait_thr| puts "stdout is:" + stdout.read puts "stderr is:" + stderr.read end
Open3.popen3(cmd) do |stdin, stdout, stderr, wait_thr| while line = stderr.gets puts line end end
http://blog.bigbinary.com/2012/10/18/backtick-system-exec-in-ruby.html
Source: https://habr.com/ru/post/1750752/More articles:Does anyone have any experience using berkeley db with PHP? - phpWhat's a good way to sync native javascript code among projects? - javascripthttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1750749/capture-stdin-input-without-echoing-characters-to-screen&usg=ALkJrhi7D9JbkUTUy_VTNAtN7Y8SaP8m6gHow to create hexadecimal digits of capital using QString :: arg ()? [QT] - qtJava instruction package - javaHow to create iOS image buttons that scale well in different resolutions? - iphone"GNU Make not found. Try setting the GNUMAKE environment variable." - installDoes the inline code support the method [that wrote in it] in memory after completion? - c #иерархический конструктор состояний с генерированием кода - c#BlockingCollection class: does the stream have an output if we take blocks? - multithreadingAll Articles