Re: [dev] [wmii] problem with wmiir xwrite /client/$client/ctl kill

From: Kris Maglione <maglione.k_AT_gmail.com>
Date: Fri, 28 May 2010 20:52:06 -0400

On Thu, May 27, 2010 at 11:22:25AM +0200, Thomas Dean wrote:
>I ran into the same problem today. The wmiirc script as well as all my
>status bar scripts die frequently. All of them are run with dash.
>Switching /bin/sh from dash to bash (and replacing dash with bash in
>wmiirc) fixes the problem. It seems to be related to the latest update
>of dash (0.5.5.1-5) in Debian.
>
>One example is the attached script, which shows my mail count, and
>shows ~/.fetchmaillog on a right click. Strangely, the script survives
>multiple right clicks (the file is shown in multiple windows), but
>dies as soon as one of those windows is closed, either via C-c, or via
>Mod-Shift-c.

They've worked out the problem on the dash list. The following
patch *should* fix your script. Alternatively, you could try the
version attached with wmii tip.

--- fetchmail.sh 2010-05-28 20:40:51.000000000 -0400
+++ - 2010-05-28 20:41:07.467485864 -0400
@@ -23,13 +23,16 @@
  wmiir xwrite /rbar/"$barname" `output`
  
  # Event loop
-{ wmiir read /event & childpid=$!
- while true; do
- echo "$barname" `output` || { kill $childpid; exit; }
- sleep $delay
- done &
-} | while read event
+pid=$$
+{
+ while echo "$barname" $(output); do
+ sleep $delay
+ done &
+ wmiir read /event
+ echo Start $barname
+} | while :
  do
+ read event
          set -f
          set -- $event
          set +f

-- 
Kris Maglione
UNIX is simple.  It just takes a genius to understand its simplicity.
	--Dennis Ritchie

Received on Sat May 29 2010 - 00:52:06 UTC

This archive was generated by hypermail 2.2.0 : Sat May 29 2010 - 01:00:03 UTC