Giter Club home page Giter Club logo

cygint's Introduction

cygint

Send Interrupt signal (SIGINT, aka Ctrl-C) to Windows process from Cygwin.

Cygwin will outright kill windows process instead of interrupting them, resulting in improperly (or not at all) terminated processes, while the CMD shell works fine. Prefixing some commands with cygint can properly interrupt them.

This is a pretty basic, rough project as yet. Showing interest in improvements may make it a reality. Pull requests welcome.

Requirements

  • bash

Compiling

Building sendctrlc.cpp will require Cygwin packages:

  • g++
  • mingw64
  • make

Other compilers may work as well, YMMV.

Build

make

Compiles sendctrlc.exe in the current directory.

Install

  • Add sendctrl.exe to your $PATH (copy to ~/bin, /usr/local/bin, etc, or update your PATH) e.g.

      echo 'PATH=$PATH:$LOCATION_OF_CYGINT' >> ~/.bashrc
    
  • Evaluate cygint.bash in your shell. Do this in your .bashrc file for a more permanent install. e.g.:

      echo 'source $LOCATION_OF_CYGINT/cygint.bash' >> ~/.bashrc
    

Use

Execute a target command in the shell, prefixed with cygint, and it will correctly respond to Ctrl-C.

$ cygint <command>

Tests

A Java test file is included. It uses a shutdown hook to print a message, which are notoriously not executed on Cygwin when using Ctrl-C.

(each invocation interrupted after 2s)

$> javac TestShutdownHooks.java
$> java TestShutdownHooks
0/20
1/20

$> cygint java TestShutdownHooks
0/20
1/20
Sending ctrl+c to: 286496
Hook called.

Known issues

  • Stopping and Backgrounding are not supported: Jobs started with cygint cannot be backgrounded or stopped (vai Ctrl-Z). Attempting this will background the process controlling your target process, but the target will continue processing, and outputting to the console.

    You can use fg followed by Ctrl-C to interrupt the target if necessary.

  • Error messages from target are being suppressed.

  • Very early project, and still has debugging output, so if it goes awry, it may pollute your console.

cygint's People

Contributors

mchenryc avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.