ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From MNewc...@tacintel.com
Subject RE: ShutdownHooks and ctrl-Cs
Date Wed, 21 Nov 2001 17:33:12 GMT
Ant queens and drones,

Is this just a concern of mine?  Or are there others with this issue...

Thanks,
Michael

-----Original Message-----
From: MNewcomb@tacintel.com [mailto:MNewcomb@tacintel.com]
Sent: Wednesday, November 21, 2001 8:33 AM
To: ant-dev@jakarta.apache.org
Subject: ShutdownHooks and ctrl-Cs


When Ant forks off processes (particularly java), is it possible for Ant to
forward ctrl-Cs to the forked process?  That would allow any shutdown hooks
that the process has registered to be run...  Right now, when I hit ctrl-C
ant dies and my program never gets the signal.

The following shutdown hook might work, well, that is assuming that
Process.destroy() is similar to a ctrl-C event.  Ant just adds and removes
new process-specific shutdown hooks before and after it forks off other
processes.

class ProcessShutdownHook
  extends Thread
{
  private Process process;

  ProcessShutdownHook(Process process)
  {
    this.process = process;
  }

  public void run()
  {
    // does destroy act like a ctrl-c, in that it
    // will wait for shutdown hooks to run?
    //
    process.destroy();
  }
}

Anyway, I would like to use ant instead of scripts, and I need this
functionality.  If this is available somehow, and I've missed it, please
e-mail me how to accomplish the desired behavior (maybe just not fork?).

Thanks,
Michael


--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>

--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message