Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
111 commits
Select commit Hold shift + click to select a range
e3dc109
Cygwin: bump dll minor version to 3.6.8
github-cygwin Mar 2, 2026
224317e
Cygwin: pty: Do not call empty WriteFile() to to_slave_nat
tyan0 Feb 28, 2026
e749a11
Cygwin: pty: Omit win32-input-mode sequence from pseudo console
tyan0 Feb 19, 2026
785151d
Cygwin: pty: Do not switch input to to_nat if native app is background
tyan0 Mar 3, 2026
c18369d
Cygwin: pty: Fix handling of data after CSI6n response
tyan0 Feb 22, 2026
7c8969d
Cygwin: pty: Fix nat pipe hand-over when pcon is disabled
tyan0 Mar 3, 2026
48e7e33
Cygwin: signal: Wait for `sendsig` for a sufficient amount of time
tyan0 Mar 10, 2026
ad853bb
Cygwin: signal: Do not wait for sendsig for non-cygwin process
tyan0 Mar 10, 2026
dfd1ca3
Cygwin: signal: Implement fake stop/cont for non-cygwin process
tyan0 Mar 10, 2026
b501f70
Cygwin: pty: Omit CSI?1004h/l from pseudo console output
tyan0 Mar 25, 2026
020203c
Cygwin: pty: Clear discard_input flag on master write()
tyan0 Mar 19, 2026
c641981
Cygwin: console: Release pipe_sw_mutex in pcon_hand_over_proc()
tyan0 Mar 24, 2026
ab7f796
Cygwin: pty: Fix input transfer when multiple non-cygwin apps exist
tyan0 Mar 10, 2026
f3914f1
Cygwin: console: Fix master thread
tyan0 Mar 20, 2026
5fd695d
Cygwin: pty: Add workaround for handling of backspace when pcon enabled
tyan0 Feb 22, 2026
57634e7
Cygwin: console: Use input_mutex in the parent PTY in master thread
tyan0 Mar 17, 2026
4c7b5b7
Cygwin: pty: Apply line_edit() for transferred input to to_cyg
tyan0 Mar 17, 2026
07ddd85
Cygwin: pty: Guard get_winpid_to_hand_over() with attach_mutex
tyan0 Mar 17, 2026
db700bb
Cygwin: pty: Guard to_be_read_from_nat_pipe() by pipe_sw_mutex
tyan0 Mar 17, 2026
6f31acb
Cygwin: pty: Drop nat_fg() check from to_be_read_from_nat_pipe()
tyan0 Mar 24, 2026
1ead4f5
Cygwin: pty: Restore nat handles in all PTY-slave instances in GDB
tyan0 Mar 8, 2026
25a9e4d
Cygwin: pty: Fix write data handling in pcon_start phase
tyan0 Mar 25, 2026
a8a61d8
Cygwin: pty: Make pcon_start handling more multi thread durable
tyan0 Mar 25, 2026
4e279fe
Cygwin: pty: Add missing DeleteProcThreadAttributeList() call
tyan0 Apr 7, 2026
5c29d7a
Cygwin: pty: Make Ctrl-C work for non-cygwin app in GDB
tyan0 Feb 28, 2026
5c12a34
Add recent more that twenty fixes to 8.6.8 release note
tyan0 Apr 19, 2026
e5c408f
Cygwin: select: Set errno when peek() returns -1
tyan0 Apr 17, 2026
daabea9
Cygwin: bump dll minor version to 3.6.9
github-cygwin Apr 21, 2026
8ff94c8
Fix msys library name in import libraries
ktbarrett Mar 14, 2021
53bb5e0
Rename dll from cygwin to msys
Alexpux Apr 14, 2019
11aaade
Add functionality for converting UNIX paths in arguments and environm…
Alexpux Apr 14, 2019
e848126
Add functionality for changing OS name via MSYSTEM environment variab…
Alexpux Apr 14, 2019
95031f0
- Move root to /usr. - Change sorting mount points. - By default moun…
Alexpux Apr 14, 2019
e3afe9b
Instead of creating Cygwin symlinks, use deep copy by default
Alexpux Apr 14, 2019
04cef96
Automatically rewrite TERM=msys to TERM=cygwin
Alexpux Apr 14, 2019
191e1b8
Do not convert environment for strace
Alexpux Apr 14, 2019
d95ef8a
strace.cc: Don't set MSYS=noglob
mingwandroid Aug 23, 2015
d515963
Add debugging for strace make_command_line
mingwandroid Aug 21, 2015
0f379db
strace --quiet: be *really* quiet
dscho May 17, 2017
c260ea2
path_conv: special-case root directory to have trailing slash
Alexpux Apr 14, 2019
2a753ad
When converting to a Unix path, avoid double trailing slashes
dscho Nov 8, 2022
ce71ac2
msys2_path_conv: pass PC_NOFULL to path_conv
lazka Nov 20, 2022
b2b3e79
path-conversion: Introduce ability to switch off conversion.
Jun 17, 2015
3b74813
dcrt0.cc: Untangle allow_glob from winshell
mingwandroid Aug 21, 2015
b58ab85
dcrt0.cc (globify): Don't quote literal strings differently when dos_…
mingwandroid Aug 23, 2015
ec43e0c
Add debugging for build_argv
mingwandroid Aug 21, 2015
fb2eb43
environ.cc: New facility/environment variable MSYS2_ENV_CONV_EXCL
mingwandroid Apr 10, 2016
ca37d02
Introduce the `enable_pcon` value for `MSYS`
dscho May 19, 2020
33b14c0
popen: call /usr/bin/sh instead of /bin/sh
lazka Jun 5, 2020
d2263a9
Disable the 'cygwin' GitHub workflow
dscho Mar 17, 2021
cd14361
CI: add a GHA for doing a basic build test
lazka Aug 9, 2020
1f25400
Set up a GitHub Action to keep in sync with Cygwin
dscho Nov 22, 2019
7a40bbe
Expose full command-lines to other Win32 processes by default
dscho Aug 12, 2020
9abc090
Add a helper to obtain a function's address in kernel32.dll
dscho Apr 16, 2018
b2413eb
Emulate GenerateConsoleCtrlEvent() upon Ctrl+C
dscho Mar 20, 2015
5e19738
kill: kill Win32 processes more gently
dscho Mar 20, 2015
450800b
Cygwin: make option for native inner link handling.
jeremyd2019 Jul 22, 2021
a0d53e4
docs: skip building texinfo and PDF files
dscho Nov 8, 2021
b0fcf02
install-libs: depend on the "toollibs"
dscho Nov 8, 2021
4e9612f
POSIX-ify the SHELL variable
dscho Nov 23, 2015
79885de
Handle ORIGINAL_PATH just like PATH
dscho Mar 21, 2017
2f1036a
uname: allow setting the system name to CYGWIN
lazka Jul 3, 2022
8fdf344
Pass environment variables with empty values
dscho Feb 18, 2015
d064b00
Optionally disallow empty environment values again
dscho Sep 6, 2022
9c78766
build_env(): respect the `MSYS` environment variable
dscho Sep 6, 2022
66cfb0c
Revert "Cygwin: Enable dynamicbase on the Cygwin DLL by default"
lazka Dec 17, 2022
546c331
Avoid sharing cygheaps across Cygwin versions
dscho Jan 30, 2023
adee13c
uname: report msys2-runtime commit hash, too
dscho Feb 21, 2023
cb25225
Cygwin: Adjust CWD magic to accommodate for the latest Windows previews
dscho May 22, 2023
aa532e7
Cygwin: Fix segfault when XSAVE area sizes are unaligned
Mar 12, 2026
d2aae93
Start the merging-rebase to cygwin-3.6.9
dscho Apr 21, 2026
7c48bb6
Merge branch 'msys2-3.6.9'
dscho Apr 21, 2026
d399a0d
fixup! Add functionality for converting UNIX paths in arguments and e…
Mar 9, 2015
1c925ce
Mention the extremely useful small_printf() function
dscho Feb 20, 2015
23d0d08
Allow native symlinks to non-existing targets in 'nativestrict' mode
kblees May 20, 2015
38393ae
WIP Handle 8-bit characters under LOCALE=C
dscho Feb 20, 2015
18a5a8a
Make paths' WCS->MBS conversion explicit
dscho Dec 18, 2015
28130fd
msys2-runtime: restore fast path for current user primary group
rglidden Aug 24, 2023
5e1d3bf
Change the default base address for x86_64
chirpnot Mar 10, 2022
53b3656
Add AGENTS.md with comprehensive project context for AI agents
dscho Feb 20, 2026
4bd00d6
Cygwin: CI: update Actions versions
dscho Nov 24, 2025
b72ad68
fixup! CI: add a GHA for doing a basic build test
dscho Nov 24, 2025
9e748a0
fixup! CI: add a GHA for doing a basic build test
dscho Aug 18, 2025
42b18bc
Merge branch 'update-github-actions-in-cygwin-ci'
dscho Oct 30, 2025
e21b4aa
Merge branch 'msys2-ci-fixups'
dscho Oct 10, 2025
f621e22
Merge branch 'msys2-path-conversion-starting-with-non-ascii'
dscho Oct 10, 2025
c8e0011
Merge branch 'mention-small-printf'
dscho Oct 10, 2025
28fc7eb
Merge pull request #10 from kblees/kb/symlinks
dscho Feb 12, 2018
ba8d98d
Merge branch 'handle-8-bit-under-locale-c'
dscho Oct 10, 2025
072a971
Merge branch 'wcstombs'
dscho Feb 12, 2018
22e8c57
Merge pull request #57 from rglidden/main
dscho Aug 28, 2023
4d57318
Merge pull request #37 from chirpnot/main
dscho May 13, 2022
bd2accd
Merge branch 'add-an-AGENTS.md-file'
dscho Feb 26, 2026
11e29af
dependabot: help keeping GitHub Actions versions up to date
dscho Feb 6, 2024
7eb77ae
Start implementing UI-based tests by adding an AutoHotKey library
dscho Oct 10, 2025
a85ceb4
ci: run Git's entire test suite
dscho Feb 12, 2024
c18d12c
Do not try to sync with Cygwin
dscho Aug 20, 2020
2a344f8
Start implementing UI-based tests by adding an AutoHotKey library
dscho Apr 21, 2026
4023ea4
Merge pull request #83 from dscho/run-gits-test-suite
dscho Jan 24, 2025
ae49b26
ci: add an AutoHotKey-based integration test
dscho May 7, 2025
c695b96
ci(ui-tests): upload the test logs
dscho Jul 5, 2025
98f3ccf
ci(ui-tests): take a screenshot when canceled
dscho Jul 4, 2025
2886c18
ui-tests: verify that a `sleep` in Windows Terminal can be interrupted
dscho Jul 3, 2025
da7e846
ui-tests: verify that interrupting clones via SSH works
dscho Jul 3, 2025
e409d12
ci(ui-tests): exclude the large repository from the build artifact
dscho Jul 5, 2025
d5fc7e3
ui-tests: add `ping` interrupt test
dscho Jul 3, 2025
4c45848
ui-tests: do verify the SSH hang fix
dscho Jul 5, 2025
60ce8df
ui-tests: minimize Log window
dscho Oct 10, 2025
84b13c6
ui-tests: add mintty launch and capture helpers to the library
dscho Feb 20, 2026
78fbb85
ui-tests: add a reproducer for the keystroke reordering bug
dscho Feb 20, 2026
6abc3bb
Merge branch 'ui-tests'
dscho May 7, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 20 additions & 3 deletions winsup/cygwin/exceptions.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1203,8 +1203,8 @@ ctrl_c_handler (DWORD type)
if (!pinfo (cygwin_pid (GetCurrentProcessId ())))
return TRUE;

if (type == CTRL_C_EVENT && ::cygheap->ctty
&& !cygheap->ctty->need_console_handler ())
if (type == CTRL_C_EVENT && !myself->is_cygwin_inferior_being_debugged ()
&& ::cygheap->ctty && !cygheap->ctty->need_console_handler ())
/* Ctrl-C is handled in fhandler_console::cons_master_thread(). */
return TRUE;

Expand Down Expand Up @@ -1500,6 +1500,23 @@ _cygtls::handle_SIGCONT ()
InterlockedAnd ((LONG *) &myself->process_state, ~PID_STOPPED);
}

inline static bool
is_stop_or_cont (int sig)
{
switch (sig)
{
case SIGSTOP:
case SIGTSTP:
case SIGTTIN:
case SIGTTOU:
case SIGCONT:
return true;
default:
break;
}
return false;
}

int
sigpacket::process ()
{
Expand Down Expand Up @@ -1653,7 +1670,7 @@ sigpacket::process ()
thissig.sa_flags &= ~SA_ONSTACK;

dosig:
if (have_execed)
if (have_execed && (ch_spawn.iscygwin () || !is_stop_or_cont (si.si_signo)))
{
switch (si.si_signo)
{
Expand Down
167 changes: 114 additions & 53 deletions winsup/cygwin/fhandler/pty.cc
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ atexit_func (void)
break;
}
CloseHandle (h_gdb_inferior);
myself->wpid_debuggee_maybe = 0;
}
}

Expand Down Expand Up @@ -255,6 +256,7 @@ CreateProcessA_Hooked
DuplicateHandle (GetCurrentProcess (), h_gdb_inferior,
GetCurrentProcess (), &h_gdb_inferior,
0, 0, DUPLICATE_SAME_ACCESS);
myself->wpid_debuggee_maybe = pi->dwProcessId;
debug_process = !!(f & (DEBUG_PROCESS | DEBUG_ONLY_THIS_PROCESS));
if (debug_process)
mutex_timeout = 0; /* to avoid deadlock in GDB */
Expand Down Expand Up @@ -294,6 +296,7 @@ CreateProcessW_Hooked
DuplicateHandle (GetCurrentProcess (), h_gdb_inferior,
GetCurrentProcess (), &h_gdb_inferior,
0, 0, DUPLICATE_SAME_ACCESS);
myself->wpid_debuggee_maybe = pi->dwProcessId;
debug_process = !!(f & (DEBUG_PROCESS | DEBUG_ONLY_THIS_PROCESS));
if (debug_process)
mutex_timeout = 0; /* to avoid deadlock in GDB */
Expand Down Expand Up @@ -1075,9 +1078,6 @@ fhandler_pty_slave::set_switch_to_nat_pipe (void)
{
isHybrid = true;
setup_locale ();
myself->exec_dwProcessId = myself->dwProcessId; /* Set this as a marker
for tty::nat_fg()
and process_sigs() */
bool stdin_is_ptys = GetStdHandle (STD_INPUT_HANDLE) == get_handle ();
setup_for_non_cygwin_app (false, NULL, stdin_is_ptys);
}
Expand Down Expand Up @@ -1109,6 +1109,7 @@ fhandler_pty_slave::reset_switch_to_nat_pipe (void)
{
CloseHandle (h_gdb_inferior);
h_gdb_inferior = NULL;
myself->wpid_debuggee_maybe = 0;
mutex_timeout = INFINITE;
if (isHybrid)
{
Expand Down Expand Up @@ -1137,23 +1138,24 @@ fhandler_pty_slave::reset_switch_to_nat_pipe (void)
else
hand_over_only (get_ttyp ());
ReleaseMutex (pipe_sw_mutex);

HANDLE input_handle_nat, output_handle_nat;
if (need_restore_handles)
{
pinfo p (get_ttyp ()->master_pid);
HANDLE pty_owner =
OpenProcess (PROCESS_DUP_HANDLE, FALSE, p->dwProcessId);
if (pty_owner)
{
CloseHandle (get_handle_nat ());
DuplicateHandle (pty_owner,
get_ttyp ()->from_master_nat (),
GetCurrentProcess (), &get_handle_nat (),
GetCurrentProcess (),
&input_handle_nat,
0, TRUE, DUPLICATE_SAME_ACCESS);
CloseHandle (get_output_handle_nat ());
DuplicateHandle (pty_owner,
get_ttyp ()->to_master_nat (),
GetCurrentProcess (),
&get_output_handle_nat (),
&output_handle_nat,
0, TRUE, DUPLICATE_SAME_ACCESS);
CloseHandle (pty_owner);
}
Expand All @@ -1177,11 +1179,12 @@ fhandler_pty_slave::reset_switch_to_nat_pipe (void)
CloseHandle (repl.to_master); /* not used. */
CloseHandle (repl.to_slave_nat); /* not used. */
CloseHandle (repl.to_slave); /* not used. */
CloseHandle (get_handle_nat ());
set_handle_nat (repl.from_master_nat);
CloseHandle (get_output_handle_nat ());
set_output_handle_nat (repl.to_master_nat);
input_handle_nat = repl.from_master_nat;
output_handle_nat = repl.to_master_nat;
}

/* Restore nat handles in all pty slave instances */
replace_nat_handles (input_handle_nat, output_handle_nat);
}
myself->exec_dwProcessId = 0;
isHybrid = false;
Expand Down Expand Up @@ -2183,6 +2186,8 @@ fhandler_pty_master::close (int flag)
ssize_t
fhandler_pty_master::write (const void *ptr, size_t len)
{
size_t orig_len = len;

ssize_t ret;
char *p = (char *) ptr;
termios &ti = tc ()->ti;
Expand All @@ -2193,6 +2198,8 @@ fhandler_pty_master::write (const void *ptr, size_t len)

push_process_state process_state (PID_TTYOU);

get_ttyp ()->discard_input = false;

if (get_ttyp ()->pcon_start)
{ /* Reaches here when pseudo console initialization is on going. */
/* Pseudo condole support uses "CSI6n" to get cursor position.
Expand All @@ -2203,19 +2210,22 @@ fhandler_pty_master::write (const void *ptr, size_t len)
static char wpbuf[wpbuf_len];
static int ixput = 0;
static int state = 0;
static DWORD wp_tid = 0;

DWORD n;
WaitForSingleObject (input_mutex, mutex_timeout);
for (size_t i = 0; i < len; i++)
len = 0;
for (size_t i = 0; i < orig_len; i++)
{
if (p[i] == '\033')
{
if (ixput)
line_edit (wpbuf, ixput, ti, &ret);
ixput = 0;
state = 1;
wp_tid = _my_tls.thread_id;
}
if (state == 1)
if (state == 1 && wp_tid == _my_tls.thread_id)
{
if (ixput < wpbuf_len)
wpbuf[ixput++] = p[i];
Expand All @@ -2229,27 +2239,32 @@ fhandler_pty_master::write (const void *ptr, size_t len)
}
else
line_edit (p + i, 1, ti, &ret);
if (state == 1 && p[i] == 'R')
len = orig_len - i - 1;
ptr = p + i + 1;
if (state == 1 && wp_tid == _my_tls.thread_id && p[i] == 'R')
state = 2;
}
if (state == 2)
{
/* req_xfer_input is true if "ESC[6n" was sent just for
triggering transfer_input() in master. In this case,
the responce sequence should not be written. */
if (!get_ttyp ()->req_xfer_input)
WriteFile (to_slave_nat, wpbuf, ixput, &n, NULL);
ixput = 0;
state = 0;
get_ttyp ()->req_xfer_input = false;
get_ttyp ()->pcon_start = false;
if (state == 2)
{
/* req_xfer_input is true if "ESC[6n" was sent just for
triggering transfer_input() in master. In this case,
the response sequence should not be written. */
if (!get_ttyp ()->req_xfer_input)
WriteFile (to_slave_nat, wpbuf, ixput, &n, NULL);
ixput = 0;
state = 0;
wp_tid = 0;
get_ttyp ()->req_xfer_input = false;
get_ttyp ()->pcon_start = false;
break;
}
}
ReleaseMutex (input_mutex);

if (!get_ttyp ()->pcon_start)
{ /* Pseudo console initialization has been done in above code. */
pinfo pp (get_ttyp ()->pcon_start_pid);
if (get_ttyp ()->switch_to_nat_pipe
&& pp && pp->pgid == get_ttyp ()->getpgid ()
&& get_ttyp ()->pty_input_state_eq (tty::to_cyg))
{
/* This accept_input() call is needed in order to transfer input
Expand All @@ -2267,8 +2282,8 @@ fhandler_pty_master::write (const void *ptr, size_t len)
}
get_ttyp ()->pcon_start_pid = 0;
}

return len;
if (len == 0)
return orig_len;
}

/* Write terminal input to to_slave_nat pipe instead of output_handle
Expand Down Expand Up @@ -2353,10 +2368,11 @@ fhandler_pty_master::write (const void *ptr, size_t len)
}

DWORD n;
WriteFile (to_slave_nat, buf, nlen, &n, NULL);
if (nlen)
WriteFile (to_slave_nat, buf, nlen, &n, NULL);
ReleaseMutex (input_mutex);

return len;
return orig_len;
}

/* The code path reaches here when pseudo console is not activated
Expand All @@ -2380,8 +2396,8 @@ fhandler_pty_master::write (const void *ptr, size_t len)
ReleaseMutex (input_mutex);

if (status > line_edit_signalled && status != line_edit_pipe_full)
ret = -1;
return ret;
return -1;
return orig_len - len + ret;
}

void
Expand Down Expand Up @@ -2885,6 +2901,39 @@ fhandler_pty_master::pty_master_fwd_thread (const master_fwd_thread_param_t *p)
else
state = 0;

/* Remove CSI ? 9001 h/l (win32-input-mode) */
/* Remove CSI ? 1004 h/l (focus report) */
int arg = 0;
state = 0;
for (DWORD i = 0; i < rlen; i++)
if (outbuf[i] == '\033')
{
start_at = i;
state = 1;
continue;
}
else if ((state == 1 && outbuf[i] == '[')
|| (state == 2 && outbuf[i] == '?'))
{
state ++;
continue;
}
else if (state == 3 && isdigit (outbuf[i]))
arg = arg * 10 + (outbuf[i] - '0');
else if (state == 3 && outbuf[i] == ';')
arg = 0;
else if (state == 3 && (arg == 9001 || arg == 1004)
&& (outbuf[i] == 'h' || outbuf[i] == 'l'))
{
memmove (&outbuf[start_at], &outbuf[i+1], rlen-i-1);
rlen = wlen = start_at + rlen - i - 1;
state = 0;
i = start_at - 1;
continue;
}
else
state = 0;

/* Remove OSC Ps ; ? BEL/ST */
state = 0;
for (DWORD i = 0; i < rlen; i++)
Expand Down Expand Up @@ -3504,7 +3553,7 @@ fhandler_pty_slave::setup_pseudoconsole ()
PROC_THREAD_ATTRIBUTE_PSEUDOCONSOLE,
hpcon, sizeof (hpcon), NULL, NULL))

goto cleanup_heap;
goto cleanup_proc_thread_attr;

hello = CreateEvent (&sec_none, true, false, NULL);
goodbye = CreateEvent (&sec_none, true, false, NULL);
Expand Down Expand Up @@ -3595,26 +3644,8 @@ fhandler_pty_slave::setup_pseudoconsole ()
while (false);

skip_create:
do
{
/* Fixup handles */
HANDLE orig_input_handle_nat = get_handle_nat ();
HANDLE orig_output_handle_nat = get_output_handle_nat ();
cygheap_fdenum cfd (false);
while (cfd.next () >= 0)
if (cfd->get_device () == get_device ())
{
fhandler_base *fh = cfd;
fhandler_pty_slave *ptys = (fhandler_pty_slave *) fh;
if (ptys->get_handle_nat () == orig_input_handle_nat)
ptys->set_handle_nat (hpConIn);
if (ptys->get_output_handle_nat () == orig_output_handle_nat)
ptys->set_output_handle_nat (hpConOut);
}
CloseHandle (orig_input_handle_nat);
CloseHandle (orig_output_handle_nat);
}
while (false);
/* Fixup handles in all PTY-slave instances */
replace_nat_handles (hpConIn, hpConOut);

if (!process_alive (get_ttyp ()->nat_pipe_owner_pid))
get_ttyp ()->nat_pipe_owner_pid = myself->exec_dwProcessId;
Expand Down Expand Up @@ -3691,6 +3722,8 @@ fhandler_pty_slave::setup_pseudoconsole ()
CloseHandle (goodbye);
CloseHandle (hr);
CloseHandle (hw);
cleanup_proc_thread_attr:
DeleteProcThreadAttributeList (si.lpAttributeList);
cleanup_heap:
HeapFree (GetProcessHeap (), 0, si.lpAttributeList);
cleanup_pseudo_console:
Expand Down Expand Up @@ -4453,3 +4486,31 @@ fhandler_pty_common::resume_from_temporarily_attach (DWORD resume_pid)
}
release_attach_mutex ();
}

void
fhandler_pty_slave::replace_nat_handles (HANDLE new_input, HANDLE new_output)
{
HANDLE orig_input_handle_nat = get_handle_nat();
HANDLE orig_output_handle_nat = get_output_handle_nat();
cygheap_fdenum cfd (false);
while (cfd.next () >= 0)
if (cfd->get_device () == get_device ())
{
fhandler_base *fh = cfd;
fhandler_pty_slave *ptys = (fhandler_pty_slave *) fh;
if (ptys->get_handle_nat () == orig_input_handle_nat)
ptys->set_handle_nat (new_input);
if (ptys->get_output_handle_nat () == orig_output_handle_nat)
ptys->set_output_handle_nat (new_output);
}
if (cygheap->ctty->get_device () == get_device ())
{
fhandler_pty_slave *ptys = (fhandler_pty_slave *) cygheap->ctty;
if (ptys->get_handle_nat () == orig_input_handle_nat)
ptys->set_handle_nat (new_input);
if (ptys->get_output_handle_nat () == orig_output_handle_nat)
ptys->set_output_handle_nat (new_output);
}
CloseHandle (orig_input_handle_nat);
CloseHandle (orig_output_handle_nat);
}
Loading
Loading