Package com.offbytwo.iclojure.signals

Source Code of com.offbytwo.iclojure.signals.ControlCSignalHandler

package com.offbytwo.iclojure.signals;

import com.offbytwo.iclojure.repl.IClojureRepl;
import sun.misc.Signal;
import sun.misc.SignalHandler;

import java.io.IOException;

public class ControlCSignalHandler implements SignalHandler {

    private IClojureRepl repl;

    public ControlCSignalHandler(IClojureRepl repl) {
        this.repl = repl;
    }

    public void install() {
        Signal signal = new Signal("INT");
        Signal.handle(signal, this);
    }

    public void handle(Signal signal) {
        try {
            repl.abortCurrentRead();
        } catch (IOException e) {
            //
        }
    }
}
TOP

Related Classes of com.offbytwo.iclojure.signals.ControlCSignalHandler

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.