On Sat, Jan 10, 2009 at 11:11:35AM +1100, Craig Small wrote:

> I'm working on another procps bug where they'd like to exit on fail.
> It's really just like your beep option only watch reacts
> differently. So for that I've moved the shorted flag for exec to -x
> using -e for exit on fail like things like bash do.

OK, that makes sense.  You might want to make it so both --beep and
--exit work correctly together.  Something like this:

  /* if child process exited in error, handle appropriately */
  if (!WIFEXITED(status) || WEXITSTATUS(status)) {
    if (option_beep) beep();
    if (option_exit) do_exit(8);
  }

> Looking at the code, is it correct to say that --beep only works if
> you don't use --exec?  I can see that the system() returns the right
> error status but I don't think exec is doing that.

No, that's not correct.  Once you exec, you don't have to worry about
returning the exit status because the child process is replaced by the
exec process.  This makes the child's exit status inherently the same
as the exec process's exit status.  So --beep should work with --exec.
I tried it experimentally, and it worked.  Simple test:

  touch "foo bar"
  watch --beep --exec ls -ld "foo bar"
  rm "foo bar"; # if a different session

This worked as expected.

- Morty



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to