sorry, dumb question possibly, I just want to make sure. if I call
some Unix command using backticks, that invokes the command, launches
a new process, and waits until that process terminates before resuming
program execution, right? especially if I do this:
shell_output = some process
which should capture the output of the process. right? it isn’t possible
to say
Sorry, reading this email reminded me of my project. Say I wanted to do
a
bunch of pings using backticks (you may have asked my stupid n00b
questin
about ``). If I wanted to do a bunch of pings, which would take some
small
amount of time, would it be better(faster) to start new threads before
doing
the ping whatever, or is there a better/different way?
Sorry, reading this email reminded me of my project. Say I wanted to do a
bunch of pings using backticks (you may have asked my stupid n00b questin
about ``). If I wanted to do a bunch of pings, which would take some small
amount of time, would it be better(faster) to start new threads before
doing
the ping whatever, or is there a better/different way?
Sure, why not use threads:
t0 = Time.now
threads = (1…10).map do |i|
Thread.new do
addr = “192.168.0.#{i}”
[addr, ping -w3 -nq #{addr}]
end
end
That depends on what you put between the back-ticks.
This:
command > /dev/null &
will almost certainly fork. There are any number of forking contingencies,
depending on what you try to run, and how.
well, that’s probably it. the command I’m using is a very long,
involved command to a complex utility that handles media files, and
apparently takes an infinite number of command-line arguments, but the
final args are “2>&1”. I inherited this code, as I understand it that
just pipes standard error and standard out to the same place –
however, now I think that might be what’s going wrong.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.