class CygwinTerminal extends UnixLikeTTYTerminal {
    private static final String STTY_LOCATION = findProgram("stty.exe");
    private static final Pattern STTY_SIZE_PATTERN = Pattern.compile(".*rows ([0-9]+);.*columns ([0-9]+);.*");
    private static final String JAVA_LIBRARY_PATH_PROPERTY = "java.library.path";
    private static final String CYGWIN_HOME_ENV = "CYGWIN_HOME";

    /**
     * Creates a new CygwinTerminal based off input and output streams and a character set to use
     * @param terminalInput Input stream to read input from
     * @param terminalOutput Output stream to write output to
     * @param terminalCharset Character set to use when writing to the output stream
     * @throws IOException If there was an I/O error when trying to initialize the class and setup the terminal
     */
    public CygwinTerminal(
            InputStream terminalInput,
            OutputStream terminalOutput,
            Charset terminalCharset) throws IOException {
        super(null,
                terminalInput,
                terminalOutput,
                terminalCharset,
                CtrlCBehaviour.TRAP);
    }

    @Override
    protected TerminalSize findTerminalSize() {
        try {
            String stty = runSTTYCommand("-a");
            Matcher matcher = STTY_SIZE_PATTERN.matcher(stty);
            if(matcher.matches()) {
                return new TerminalSize(Integer.parseInt(matcher.group(2)), Integer.parseInt(matcher.group(1)));
            }
            else {
                return new TerminalSize(80, 24);
            }
        }
        catch(Throwable e) {
            return new TerminalSize(80, 24);
        }
    }

    @Override
    protected String runSTTYCommand(String... parameters) throws IOException {
        List<String> commandLine = new ArrayList<>(Arrays.asList(
                findSTTY(),
                "-F",
                getPseudoTerminalDevice()));
        commandLine.addAll(Arrays.asList(parameters));
        return exec(commandLine.toArray(new String[0]));
    }

    @Override
    protected void acquire() throws IOException {
        super.acquire();
        // Placeholder in case we want to add extra stty invocations for Cygwin
    }

    private String findSTTY() {
        return STTY_LOCATION;
    }

    private String getPseudoTerminalDevice() {<FILL_FUNCTION_BODY>}

    private static String findProgram(String programName) {
        if (System.getenv(CYGWIN_HOME_ENV) != null) {
            File cygwinHomeBinFile = new File(System.getenv(CYGWIN_HOME_ENV) + "/bin", programName);
            if (cygwinHomeBinFile.exists()) {
                return cygwinHomeBinFile.getAbsolutePath();
            }
        }
        String[] paths = System.getProperty(JAVA_LIBRARY_PATH_PROPERTY).split(";");
        for(String path : paths) {
            File shBin = new File(path, programName);
            if(shBin.exists()) {
                return shBin.getAbsolutePath();
            }
        }
        return programName;
    }
}

        //This will only work if you only have one terminal window open, otherwise we'll need to figure out somehow
        //which pty to use, which could be very tricky...
        return "/dev/pty0";
    
<methods><variables>private java.lang.String sttyStatusToRestore,private final non-sealed java.io.File ttyDev