Ok, so I decided to hack around with a project I might feasably get to
work. Strangely enough, it actually works. Except for reasons
unknown, I'm forced to include a kludge so that it works
_consistantly_. I'm curious to learn about this inconsistancy, and
because I simply have no clue, I'd like to ask for some opinions.
Overview: Accept input and then launch that process.
# ------ begin script
command_line = gets.chomp
command_line = "nohup " + command_line.to_s + "&exit"
system(command_line)
# we can still continue to do other stuff.
# ------ end script
script home: http://sysy.homeip.net/mw/index.php/TRN_-_Launcher
Except that thanks to my preferred method of calling it, it only
inconsistantly works.
* Method 1 (always works):
ruby script.rb
xterm
This launches the script, and when I type in "xterm", xterm gets
launched and then script.rb exits.
* Method 2 (rarely works)
xterm -e ruby script.rb
xterm
This launches an xterm window which launches the script, and when I
type in "xterm", xterm only *sometimes* launches.
* Note: freely replace "xterm" with "rxvt".. both seem to act the same
* The Kludge
Append this:
pause = gets
and the launcher always works as expected, with both methods of
running the script.
Or append this:
10000.times do
puts "do something stupid to delay exiting"
end
and (for me), the launcher always works as expected. However, when I
lowered this to 1,000 it was still inconsistant.
Yes, I didn't know how to make ruby pause / think in a more
"efficiant" non-horribly-kludged way. But my intutition told me that
xterm -e had xterm exit so fast that the script it was supposed to
execute.. wasn't.
···
--
So.. I am guessing that during a failure in "xterm -e ruby script.rb"
one of these must be true:
* xterm is not launching ruby script.rb
* ruby is not running script.rb
* script.rb is not launching my command (via "system")
* "nohup" within script.rb is not launching my command
* my command is having problems with being executed in this manner.
--
Ideas?
What have I missed?