From: Takashi Yano <takashi.yano@nifty.ne.jp>
To: cygwin-developers@cygwin.com
Subject: Re: New implementation of pseudo console support (experimental)
Date: Fri, 24 Jul 2020 02:17:40 +0900 [thread overview]
Message-ID: <20200724021740.8cca18532c7873f1f6c34570@nifty.ne.jp> (raw)
In-Reply-To: <9f7a8e29-5a65-eead-e3d9-a5d135ea21c6@towo.net>
[-- Attachment #1: Type: text/plain, Size: 3979 bytes --]
Hi Thomas,
On Sat, 18 Jul 2020 22:57:24 +0200
Thomas Wolff wrote:
> Am 18.07.2020 um 07:05 schrieb Takashi Yano via Cygwin-developers:
> > Hi Thomas,
> >
> > Thanks for testing.
> >
> > On Fri, 17 Jul 2020 16:59:56 +0200
> > Thomas Wolff wrote:
> >> Am 17.07.2020 um 14:47 schrieb Thomas Wolff:
> >>> Am 17.07.2020 um 13:19 schrieb Corinna Vinschen:
> >>>> Hi Takashi,
> >>>>
> >>>> On Jul 1 20:47, Takashi Yano via Cygwin-developers wrote:
> >>>>> On Fri, 29 May 2020 00:40:24 +0900
> >>>>> Takashi Yano via Cygwin-developers <cygwin-developers@cygwin.com>
> >>>>> wrote:
> >>>>>> On Tue, 26 May 2020 10:09:55 +0900
> >>>>>> Takashi Yano via Cygwin-developers <cygwin-developers@cygwin.com>
> >>>>>> wrote:
> >>>>>>> On Mon, 25 May 2020 19:53:32 +0900
> >>>>>>> Takashi Yano via Cygwin-developers <cygwin-developers@cygwin.com>
> >>>>>>> wrote:
> >>>>>>>> On Tue, 19 May 2020 22:40:18 +0900
> >>>>>>>> Takashi Yano via Cygwin-developers <cygwin-developers@cygwin.com>
> >>>>>>>> wrote:
> >>>>>>>>> On Sat, 16 May 2020 16:47:35 +0900
> >>>>>>>>> Takashi Yano via Cygwin-developers
> >>>>>>>>> <cygwin-developers@cygwin.com> wrote:
> >>>>>>>>>> On Sat, 16 May 2020 09:29:56 +0900
> >>>>>>>>>> Takashi Yano via Cygwin-developers
> >>>>>>>>>> <cygwin-developers@cygwin.com> wrote:
> >>>>>>>>>>> Fix a small bug caused when stdio is redirected to another pty.
> >>>>>>>>>> Fix another bug caused when stdio is redirected to another pty.
> >>>>>>>>> Revise the patch to fit the current git head.
> >>>>>>>> Revise the patch again to fit the current git head.
> >>>>>>> Make app, which reads stdin, work under gdb.
> >>>>>> * Prevent ResizePseudoConsole() calls unless the pty is resized.
> >>>>>> * Revise the patch to fit the current git head.
> >>>>> Revise the patch to fit the current git head.
> >>>> are you satisfied with the code? If you want to merge it,
> >>>> I'd bump Cygwin to 3.2.
> >>> (blush) I apologize, I had promised to run my test cases.
> >>> Beginning with it, the first succeeded, the second failed:
> >>> run notepad (from mintty), click back into terminal, enter ^Z
> >>> It says "Stopped" but the process is gone.
> >>>
> >>> Continuing may test suite soon...
> >> OK, so here are finally my updated test results:
> >>
> >>
> >> resize terminal while running Windows cmd
> >> run cmd, resize, run dir/P:
> >> ✓works
> >>
> >>
> >> terminal reports in response to request escape sequences
> >> ("\033[6n", "\033[0c", "\033[>c", '\033[18t', '\033]10;?\033\')
> >> ✓works
> >>
> >>
> >> output to alternate screen
> >> echo -e "\e[?1047h"; cmd
> >> ✓works
> >> cmd
> >> from other terminal: echo -e "\e[?1047h" > /dev/pty...
> >> ↯no output; weird behaviour on ^C, mintty terminating (also in 3.1.6)
> > I found this is a bug introduced in commit
> > 0365031ce1347600d854a23f30f1355745a1765c.
> >
> > I will submit a patch for this issue.
> >
> >> signal handling/mediation; catch SIGTSTP
> >> run notepad, click back into terminal, enter ^Z
> >> ↯fails, notepad is terminated
> >> -> this is a regression, ^Z,^C,^\ used to be ignored
> > This behaviour is the same as cygwin 3.0.7. Pseudo console is not
> > activated for native GUI processes.
> OK, I understand this is consistent with my own proposal to apply pseudo
> console only for Windows command-line programs. On the other hand, fatal
> signal handling is another nuisance of running Windows programs from
> cygwin, so there was a benefit.
> Is it possible to activate the signal interworking without setting up a
> pseudo console? If not, is it maybe worth to set it up also for Windows
> GUI programs just for this purpose? (Modifying my proposal to trigger on
> any Windows program.)
When pseudo console is activated for GUI apps, ^C, ^Z and ^\ are
just ignored. Please try additional patch attached with the latest
pseudo console patch. Is this as you expected?
I'm not sure which behaviour is better. Does anyone have opinion?
--
Takashi Yano <takashi.yano@nifty.ne.jp>
[-- Attachment #2: pcon-activate-for-gui-apps.diff --]
[-- Type: text/plain, Size: 1165 bytes --]
diff --git a/winsup/cygwin/spawn.cc b/winsup/cygwin/spawn.cc
index a3071884e..4524423b3 100644
--- a/winsup/cygwin/spawn.cc
+++ b/winsup/cygwin/spawn.cc
@@ -194,24 +194,6 @@ handle (int fd, bool writing)
return h;
}
-static bool
-is_console_app (WCHAR *filename)
-{
- HANDLE h;
- const int id_offset = 92;
- h = CreateFileW (filename, GENERIC_READ, FILE_SHARE_READ,
- NULL, OPEN_EXISTING, 0, NULL);
- char buf[1024];
- DWORD n;
- ReadFile (h, buf, sizeof (buf), &n, 0);
- CloseHandle (h);
- char *p = (char *) memmem (buf, n, "PE\0\0", 4);
- if (p && p + id_offset <= buf + n)
- return p[id_offset] == '\003'; /* 02: GUI, 03: console */
- else
- return false;
-}
-
int
iscmd (const char *argv0, const char *what)
{
@@ -632,7 +614,7 @@ child_info_spawn::worker (const char *prog_arg, const char *const *argv,
STARTUPINFOEXW si_pcon;
ZeroMemory (&si_pcon, sizeof (si_pcon));
STARTUPINFOW *si_tmp = &si;
- if (!iscygwin () && ptys_primary && is_console_app (runpath))
+ if (!iscygwin () && ptys_primary)
if (ptys_primary->setup_pseudoconsole (&si_pcon))
{
c_flags |= EXTENDED_STARTUPINFO_PRESENT;
next prev parent reply other threads:[~2020-07-23 17:18 UTC|newest]
Thread overview: 73+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-13 12:16 Takashi Yano
2020-05-13 12:35 ` Thomas Wolff
2020-05-14 9:28 ` Takashi Yano
2020-05-14 9:34 ` Takashi Yano
2020-05-16 0:29 ` Takashi Yano
2020-05-16 7:47 ` Takashi Yano
2020-05-19 13:40 ` Takashi Yano
2020-05-25 10:53 ` Takashi Yano
2020-05-25 15:22 ` Corinna Vinschen
2020-05-25 19:16 ` Thomas Wolff
2020-05-26 1:00 ` Takashi Yano
2020-05-26 7:14 ` Thomas Wolff
2020-05-26 9:21 ` Takashi Yano
2020-05-26 9:32 ` Thomas Wolff
2020-05-26 8:33 ` Corinna Vinschen
2020-05-26 1:09 ` Takashi Yano
2020-05-28 15:40 ` Takashi Yano
2020-05-29 15:30 ` Corinna Vinschen
2020-05-30 7:36 ` Takashi Yano
2020-05-30 13:14 ` Takashi Yano
2020-05-30 17:43 ` Corinna Vinschen
2020-05-31 5:52 ` Takashi Yano
2020-07-01 11:47 ` Takashi Yano
2020-07-17 11:19 ` Corinna Vinschen
2020-07-17 12:47 ` Thomas Wolff
2020-07-17 14:59 ` Thomas Wolff
2020-07-18 5:05 ` Takashi Yano
2020-07-18 20:57 ` Thomas Wolff
2020-07-23 17:17 ` Takashi Yano [this message]
2020-07-27 17:10 ` Thomas Wolff
2020-07-17 12:52 ` Ken Brown
2020-07-18 5:07 ` Takashi Yano
2020-07-18 5:30 ` Takashi Yano
2020-07-20 8:06 ` Corinna Vinschen
2020-07-21 18:17 ` Takashi Yano
2020-07-22 8:45 ` Takashi Yano
2020-07-22 11:49 ` Corinna Vinschen
2020-07-22 12:13 ` Ken Brown
2020-07-23 0:33 ` Takashi Yano
2020-07-24 5:38 ` Takashi Yano
2020-07-24 11:22 ` Takashi Yano
2020-08-02 12:01 ` Corinna Vinschen
2020-08-03 2:05 ` Takashi Yano
2020-08-03 10:50 ` Corinna Vinschen
2020-08-03 2:11 ` Takashi Yano
2020-08-03 12:23 ` Takashi Yano
2020-08-11 11:12 ` Takashi Yano
2020-08-13 9:58 ` Takashi Yano
2020-08-17 11:57 ` Takashi Yano
2020-08-19 11:39 ` Takashi Yano
2020-08-19 13:41 ` Corinna Vinschen
2020-08-19 15:43 ` Thomas Wolff
2020-08-19 20:47 ` Mark Geisert
2020-08-20 8:02 ` Takashi Yano
2020-08-31 12:49 ` Johannes Schindelin
2020-08-31 14:14 ` Takashi Yano
[not found] ` <20200831231253.332c66fdddb33ceed5f61db6@nifty.ne.jp>
2020-08-31 14:22 ` Johannes Schindelin
2020-08-31 14:53 ` Takashi Yano
2020-08-31 15:56 ` Johannes Schindelin
2020-08-31 16:12 ` Thomas Wolff
2020-08-31 17:39 ` Thomas Wolff
2020-08-31 19:17 ` Johannes Schindelin
2020-08-31 19:37 ` Corinna Vinschen
2020-09-01 4:46 ` Johannes Schindelin
2020-09-01 9:23 ` Takashi Yano
2020-09-01 6:32 ` Johannes Schindelin
2020-09-01 22:33 ` Takashi Yano
2020-09-02 6:13 ` Johannes Schindelin
2020-09-01 9:42 ` Takashi Yano
2020-08-31 21:07 ` Thomas Wolff
2020-08-31 23:23 ` Takashi Yano
2020-09-01 5:00 ` Johannes Schindelin
2020-09-01 8:56 ` Thomas Wolff
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200724021740.8cca18532c7873f1f6c34570@nifty.ne.jp \
--to=takashi.yano@nifty.ne.jp \
--cc=cygwin-developers@cygwin.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).