Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
[PATCH] Make zpty module work in the cygwin and msys2
- X-seq: zsh-workers 47833
- From: Peiyuan Song <squallatf@xxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: [PATCH] Make zpty module work in the cygwin and msys2
- Date: Fri, 15 Jan 2021 11:14:23 +0800
- Archived-at: <https://zsh.org/workers/47833>
- Archived-at: <http://www.zsh.org/sympa/arcsearch_id/zsh-workers/2021-01/CAE0YKFtLRCGLdfGd1zSb5NBK%2Bn%3DXkK7rUJ%2BMsLUUrEOaZK-79A%40mail.gmail.com>
- List-id: <zsh-workers.zsh.org>
cygwin have /dev/ptmx, need defined `_GNU_SOURCE 1` to use it, but
configure check /dev/ptmx is usable only defined it for linux.
Another probleam is cygwin upstream have an issue
https://cygwin.com/pipermail/cygwin-developers/2021-January/012030.html,
because of that issue, movefd will broken the fd opened by
posix_openpt, so that we mast disable movefd in zpty until cygwin
fix that issue.
---
Src/Modules/zpty.c | 2 ++
configure.ac | 2 +-
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/Src/Modules/zpty.c b/Src/Modules/zpty.c
index 45fd15ee0..eadb7ceac 100644
--- a/Src/Modules/zpty.c
+++ b/Src/Modules/zpty.c
@@ -428,6 +428,7 @@ newptycmd(char *nam, char *pname, char **args, int
echo, int nblock)
mypid = 0; /* trick to ensure we _exit() */
zexit(lastval, ZEXIT_NORMAL);
}
+#ifndef __CYGWIN__
master = movefd(master);
if (master == -1) {
zerrnam(nam, "cannot duplicate fd %d: %e", master, errno);
@@ -435,6 +436,7 @@ newptycmd(char *nam, char *pname, char **args, int
echo, int nblock)
ineval = oineval;
return 1;
}
+#endif
p = (Ptycmd) zalloc(sizeof(*p));
diff --git a/configure.ac b/configure.ac
index 549cae3d6..16dafac05 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2460,7 +2460,7 @@ if test x$ac_cv_have_dev_ptmx = xyes -o
x$ac_cv_func_posix_openpt = xyes && \
test x$ac_cv_func_ptsname = xyes; then
AC_CACHE_CHECK([if /dev/ptmx is usable],
ac_cv_use_dev_ptmx,
- [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#ifdef __linux
+ [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#if defined(__linux) ||
defined(__CYGWIN__)
#define _GNU_SOURCE 1
#endif
#include <stdlib.h>
--
2.30.0.windows.1
Messages sorted by:
Reverse Date,
Date,
Thread,
Author