aboutsummaryrefslogtreecommitdiff
path: root/winsup/cygwin/spawn.cc
diff options
context:
space:
mode:
authorTakashi Yano <takashi.yano@nifty.ne.jp>2022-07-31 17:42:00 +0900
committerTakashi Yano <takashi.yano@nifty.ne.jp>2022-07-31 17:55:42 +0900
commitd5229f821160c9e9875c4b662f5be097b7cf6d18 (patch)
tree6fcde4feff08c63c60e867a288a09386d8797dfc /winsup/cygwin/spawn.cc
parent8d564b62b711bc93850c1b6a8632196abc4768cf (diff)
downloadnewlib-d5229f821160c9e9875c4b662f5be097b7cf6d18.zip
newlib-d5229f821160c9e9875c4b662f5be097b7cf6d18.tar.gz
newlib-d5229f821160c9e9875c4b662f5be097b7cf6d18.tar.bz2
Cygwin: pty: Treat *.bat and *.cmd as a non-cygwin console app.
- If *.bat or *.cmd is executed directly from cygwin shell, pty failed to switch I/O pipe to that for native apps. This patch fixes the issue.
Diffstat (limited to 'winsup/cygwin/spawn.cc')
-rw-r--r--winsup/cygwin/spawn.cc7
1 files changed, 6 insertions, 1 deletions
diff --git a/winsup/cygwin/spawn.cc b/winsup/cygwin/spawn.cc
index 2f745e1..7de9682 100644
--- a/winsup/cygwin/spawn.cc
+++ b/winsup/cygwin/spawn.cc
@@ -227,7 +227,12 @@ is_console_app (WCHAR *filename)
if (p && p + id_offset <= buf + n)
return p[id_offset] == '\003'; /* 02: GUI, 03: console */
else
- return false;
+ {
+ wchar_t *e = wcsrchr (filename, L'.');
+ if (e && (wcscasecmp (e, L".bat") == 0 || wcscasecmp (e, L".cmd") == 0))
+ return true;
+ }
+ return false;
}
int