Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > "ruby script.rb" versus "xterm -e ruby script.rb"

Reply
Thread Tools

"ruby script.rb" versus "xterm -e ruby script.rb"

 
 
Sy
Guest
Posts: n/a
 
      04-16-2005
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?



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Mozilla versus IE versus Opera versus Safari Peter Potamus the Purple Hippo Firefox 0 05-08-2008 12:56 PM
equal? versus eql? versus == versus === verus <=> Paul Butcher Ruby 12 11-28-2007 06:06 AM
Certification - MCP versus MCSA versus MCSE =?Utf-8?B?Q2FuYWRhX0d1eU0=?= Microsoft Certification 1 08-24-2006 06:33 PM
script versus code versus ? Russ ASP .Net 1 06-10-2004 03:06 AM
HTML Client Control versus. HTML Server Control versus. Web Server Control Matthew Louden ASP .Net 1 10-11-2003 07:09 PM



Advertisments