On Thu, 19 Apr 2007, Marcin R. wrote:
starts but returns anything other then 0
does anyone know good way to check if command exists then run it, return pid
for monitoring purposes and allow bidirectional comunication, then check exit
status ?
open4 comes close to fulfilling all that but it doesn’t rise (sample program
that tells you it’ll doesn’t eaither),
??
harp:~ > ruby -r open4 -e’ Open4.popen4 “no-exist” ’
/home/ahoward//lib/ruby/site_ruby/1.8/open4.rb:37:in exec': No such file or directory - no-exist (Errno::ENOENT) from /home/ahoward//lib/ruby/site_ruby/1.8/open4.rb:37:in
popen4’
from /home/ahoward//lib/ruby/site_ruby/1.8/open4.rb:21:in
`popen4’
from -e:1
harp:~ > ruby -r open4 -e’ Open4.spawn “no-exist” ’
/home/ahoward//lib/ruby/site_ruby/1.8/open4.rb:37:in exec': No such file or directory - no-exist (Errno::ENOENT) from /home/ahoward//lib/ruby/site_ruby/1.8/open4.rb:37:in
popen4’
from /home/ahoward//lib/ruby/site_ruby/1.8/open4.rb:21:in
popen4' from /home/ahoward//lib/ruby/site_ruby/1.8/open4.rb:273:in
spawn’
from /home/ahoward//lib/ruby/1.8/timeout.rb:38:in timeout' from /home/ahoward//lib/ruby/site_ruby/1.8/open4.rb:272:in
spawn’
from -e:1
from the dist
harp:open4-0.9.3 > pwd
/home/ahoward/eg/ruby/open4/open4-0.9.3
harp:open4-0.9.3 > cat sample/exception.rb
require “open4”
Open4::popen4 “noexist”
harp:open4-0.9.3 > ruby sample/exception.rb
/home/ahoward/nfs//lib/ruby/site_ruby/1.8/open4.rb:37:in exec': No such file or directory - noexist (Errno::ENOENT) from /home/ahoward/nfs//lib/ruby/site_ruby/1.8/open4.rb:37:in
popen4’
from /home/ahoward/nfs//lib/ruby/site_ruby/1.8/open4.rb:21:in
fork' from /home/ahoward/nfs//lib/ruby/site_ruby/1.8/open4.rb:21:in
popen4’
from sample/exception.rb:3
can you show an exampe which does not work?
not to mention compleate lack of > documentation.
??
http://codeforpeople.com/lib/ruby/open4/open4-0.9.3/README
this covers nearly every part of open4. if you need more, there is
http://codeforpeople.com/lib/ruby/open4/open4-0.9.3/lib/open4.rb
it is an extremely small library
any expirience with open4? help? pointers?
mayby i’m simply missing some obvious way?
i wrote open4 - so i’m expirienced with it can you give and example
of
exactly what you’re trying to do?
regards.
-a