delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2012/12/12/12:26:36

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=1.3 required=5.0 tests=AWL,BAYES_20,DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,KHOP_THREADED,NML_ADSP_CUSTOM_MED,SPF_NEUTRAL,URI_HEX
X-Spam-Check-By: sourceware.org
Date: Wed, 12 Dec 2012 09:26:05 -0800 (PST)
From: erik56d <erik56d AT gmail DOT com>
To: cygwin AT cygwin DOT com
Message-ID: <1355333165623-94878.post@n5.nabble.com>
In-Reply-To: <BLU0-SMTP84523E7025AAAA0A7CB05ECE4F0@phx.gbl>
References: <1355306723154-63179 DOT post AT n5 DOT nabble DOT com> <CAMK_jUXuu9Bmwurx733P3kV4EevCpens5ESnsP6EcRAWbxiBFQ AT mail DOT gmail DOT com> <1355306723156-63181 DOT post AT n5 DOT nabble DOT com> <1355306723157-63182 DOT post AT n5 DOT nabble DOT com> <501AB915 DOT 5050106 AT saic DOT com> <1355306723094-94866 DOT post AT n5 DOT nabble DOT com> <BLU0-SMTP84523E7025AAAA0A7CB05ECE4F0 AT phx DOT gbl>
Subject: Re: CTRL+C is not working with java on latest cygwin 1.7.15
MIME-Version: 1.0
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

There is nothing special about the Java program. Might be e.g. 
public class ShutdownHookTester
{
  public static void main(String[] args) {
    Runtime.getRuntime().addShutdownHook(new Thread()
    {
      public void run() {
        System.out.println("Cleaning up");
      }
    });
    for (int i=0;i<10000;i++)
    {
      System.out.print(".");
      try {
        Thread.sleep(1000);
      } catch (InterruptedException e) {
      }
    }
  }
}

When run under CygWin, pressing CTRL-C will just give you your shell prompt:
$java -cp target/other-utils-1.0.jar com.edb.bds.util.ShutdownHookTester
...
$
Run from cmd.exe, however, the Shutdown Hook is executed as it should be,
yielding:
C:\java -cp . com.edb.bds.util.ShutdownHookTester
....Cleaning up
C:\




--
View this message in context: http://cygwin.1069669.n5.nabble.com/CTRL-C-is-not-working-with-java-on-latest-cygwin-1-7-15-tp63179p94878.html
Sent from the Cygwin list mailing list archive at Nabble.com.

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019