aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/cygwin.yml1
-rw-r--r--winsup/cygwin/fhandler/console.cc33
2 files changed, 23 insertions, 11 deletions
diff --git a/.github/workflows/cygwin.yml b/.github/workflows/cygwin.yml
index 54d7de1..f45e652 100644
--- a/.github/workflows/cygwin.yml
+++ b/.github/workflows/cygwin.yml
@@ -255,6 +255,7 @@ jobs:
export LOGDIR=$(cygpath -a logs)
winsup/testsuite/stress/cygstress CI
shell: bash --noprofile --norc -o igncr -eo pipefail '{0}'
+ continue-on-error: ${{ matrix.runarch == 'arm64' }}
# upload logs artifact
- name: Capture logs artifact
diff --git a/winsup/cygwin/fhandler/console.cc b/winsup/cygwin/fhandler/console.cc
index 2e19e0d..16352d0 100644
--- a/winsup/cygwin/fhandler/console.cc
+++ b/winsup/cygwin/fhandler/console.cc
@@ -771,6 +771,8 @@ fhandler_console::setup ()
con.disable_master_thread = true;
con.master_thread_suspended = false;
con.num_processed = 0;
+ con.curr_input_mode = tty::restore;
+ con.curr_output_mode = tty::restore;
}
}
@@ -849,11 +851,6 @@ fhandler_console::set_input_mode (tty::cons_mode m, const termios *t,
flags |= ENABLE_PROCESSED_INPUT;
break;
}
- if (con.curr_input_mode != tty::cygwin && m == tty::cygwin)
- {
- prev_input_mode_backup = con.prev_input_mode;
- con.prev_input_mode = oflags;
- }
con.curr_input_mode = m;
SetConsoleMode (p->input_handle, flags);
if (!(oflags & ENABLE_VIRTUAL_TERMINAL_INPUT)
@@ -893,11 +890,6 @@ fhandler_console::set_output_mode (tty::cons_mode m, const termios *t,
flags |= DISABLE_NEWLINE_AUTO_RETURN;
break;
}
- if (con.curr_output_mode != tty::cygwin && m == tty::cygwin)
- {
- prev_output_mode_backup = con.prev_output_mode;
- GetConsoleMode (p->output_handle, &con.prev_output_mode);
- }
con.curr_output_mode = m;
acquire_attach_mutex (mutex_timeout);
DWORD resume_pid = attach_console (con.owner);
@@ -1845,6 +1837,12 @@ fhandler_console::open (int flags, mode_t)
handle_set.output_handle = h;
release_output_mutex ();
+ if (con.owner == GetCurrentProcessId ())
+ {
+ GetConsoleMode (get_handle (), &con.prev_input_mode);
+ GetConsoleMode (get_output_handle (), &con.prev_output_mode);
+ }
+
wpbuf.init ();
handle_set.input_mutex = input_mutex;
@@ -1890,6 +1888,19 @@ fhandler_console::open (int flags, mode_t)
setenv ("TERM", "cygwin", 1);
}
+ if (con.curr_input_mode != tty::cygwin)
+ {
+ prev_input_mode_backup = con.prev_input_mode;
+ GetConsoleMode (get_handle (), &con.prev_input_mode);
+ set_input_mode (tty::cygwin, &get_ttyp ()->ti, &handle_set);
+ }
+ if (con.curr_output_mode != tty::cygwin)
+ {
+ prev_output_mode_backup = con.prev_output_mode;
+ GetConsoleMode (get_output_handle (), &con.prev_output_mode);
+ set_output_mode (tty::cygwin, &get_ttyp ()->ti, &handle_set);
+ }
+
debug_printf ("opened conin$ %p, conout$ %p", get_handle (),
get_output_handle ());
@@ -4738,7 +4749,7 @@ fhandler_console::cons_mode_on_close (handle_set_t *p)
NTSTATUS status =
NtQueryInformationProcess (GetCurrentProcess (), ProcessBasicInformation,
&pbi, sizeof (pbi), NULL);
- if (NT_SUCCESS (status)
+ if (NT_SUCCESS (status) && cygwin_pid (con.owner)
&& !process_alive ((DWORD) pbi.InheritedFromUniqueProcessId))
/* Execed from normal cygwin process and the parent has been exited. */
return tty::cygwin;