bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

trap behavior with ( x & ) | ...


From: John Valente
Subject: trap behavior with ( x & ) | ...
Date: Wed, 25 Oct 2000 17:21:06 -0700

Sorry, I admit I haven't scoured every alternate source for information,
but I have a simple question.  Responding with a pointer to where the
answer is documented would be fine.  Thanks.  Here's the script:

#!/bin/bash

handle_signal ()
{
  echo "signal handler"
  exit 0
}

trap "handle_signal" 1 2 3

(java DoNothing&) | tee /tmp/logfile.txt

echo "no signal handler"

On my Linux (2.2.14-5.0 #1) box with bash 1.14.7(1), the signal handler
is not called.  On Solaris (5.7) with bash 2.04, the signal handler is
called.  As you may guess, I'd like the signal to be trapped, but I
can't say for sure that it's a bug.  Any ideas?

P.S. I don't think "java DoNothing" is important at all, it's the
interaction between ( ), &, and |, but just for completeness, here's the
source code for the dummy Java file:

public class DoNothing
{
  public static void main (String args[]) {
    for ( ; ; ) {
      System.out.println("running");
      System.out.flush();
      try { Thread.sleep(3000); } catch (InterruptedException ie) {}
    }
  }
}

Thanks for any help,
John




reply via email to

[Prev in Thread] Current Thread [Next in Thread]