Re: [wmii] Ruby-IXP 0.1 - restarting patch

From: Suraj N. Kurapati <skurapat_AT_ucsc.edu>
Date: Mon, 03 Jul 2006 00:06:21 -0700

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello,

I understand the mechanism used by the standard wmiirc to restart
itself (just run another wmiirc process and it will broadcast the
"Start wmiirc\n" to '/event', causing any existing wmiirc processes
to exit from their event loops).

But I'm not understanding the mechanism used to restart the
wmiirc-astro example, because this mechanism is only available as an
internal action:

      when 'restart' then
        Thread.list.each { |t| t.kill unless t == Thread.current }
        "ruby #{__FILE__}"

What happens when another wmiirc-astro process is run? Does the
first one terminate? If not, please see the attached patch which
re-introduces the mechanism used by the standard wmiirc.

Thanks for your attention.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)

iD8DBQFEqMHsmV9O7RYnKMcRAnzfAJ0ZItoJCJMIOJwc1ouZ9680LF+NiACgksw8
YhAxEjGiM5zvXyrwCtj+iy0=
=s0C6
-----END PGP SIGNATURE-----

diff -ur ruby-ixp-0.1.orig/examples/wmiirc-astro ruby-ixp-0.1/examples/wmiirc-astro
--- ruby-ixp-0.1.orig/examples/wmiirc-astro 2006-07-02 10:25:01.000000000 -0700
+++ ruby-ixp-0.1/examples/wmiirc-astro 2006-07-02 23:58:40.000000000 -0700
@@ -22,8 +22,6 @@
 $:.unshift File::dirname(__FILE__) + '/../lib'
 require 'wmii'
 
-# Startdelay
-
 COLORS_BLUE = '#ffffff #285577 #4c7899'
 COLORS_RED = '#ffffff #993308 #b9582c'
 COLORS_GREEN = '#ffffff #287755 #4c9978'
@@ -32,6 +30,8 @@
 
 Thread.abort_on_exception = true
 wmii = WMII::new
+# Startdelay
+wmii.write('/event', "Start wmiirc\n")
 wmii.border = 2
 wmii.normcolors = '#ffffff #285577 #4c7899'
 wmii.selcolors = '#ffffff #993308 #b9582c'
 
diff -ur ruby-ixp-0.1.orig/lib/wmii.rb ruby-ixp-0.1/lib/wmii.rb
--- ruby-ixp-0.1.orig/lib/wmii.rb 2006-07-02 10:25:01.000000000 -0700
+++ ruby-ixp-0.1/lib/wmii.rb 2006-07-03 00:00:36.000000000 -0700
@@ -77,6 +77,8 @@
         event, args = line.chomp.split(' ', 2)
 
         case event
+ when 'Start'
+ return if args == 'wmiirc'
           when 'Key'
             @key_blocks.each { |sym,block|
               if sym == args
Received on Mon Jul 03 2006 - 09:08:00 UTC

This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 16:10:28 UTC