@shitiandmw/node-pty 1.1.0-agent.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (288) hide show
  1. package/LICENSE +69 -0
  2. package/README.md +170 -0
  3. package/binding.gyp +111 -0
  4. package/deps/.editorconfig +2 -0
  5. package/deps/winpty/.drone.yml +17 -0
  6. package/deps/winpty/.gitattributes +19 -0
  7. package/deps/winpty/LICENSE +21 -0
  8. package/deps/winpty/Makefile +166 -0
  9. package/deps/winpty/README.md +151 -0
  10. package/deps/winpty/RELEASES.md +280 -0
  11. package/deps/winpty/VERSION.txt +1 -0
  12. package/deps/winpty/configure +167 -0
  13. package/deps/winpty/misc/BufferResizeTests.cc +90 -0
  14. package/deps/winpty/misc/ChangeScreenBuffer.cc +53 -0
  15. package/deps/winpty/misc/ClearConsole.cc +72 -0
  16. package/deps/winpty/misc/ConinMode.cc +117 -0
  17. package/deps/winpty/misc/ConinMode.ps1 +116 -0
  18. package/deps/winpty/misc/ConoutMode.cc +113 -0
  19. package/deps/winpty/misc/DebugClient.py +42 -0
  20. package/deps/winpty/misc/DebugServer.py +63 -0
  21. package/deps/winpty/misc/DumpLines.py +5 -0
  22. package/deps/winpty/misc/EnableExtendedFlags.txt +46 -0
  23. package/deps/winpty/misc/Font-Report-June2016/CP437-Consolas.txt +528 -0
  24. package/deps/winpty/misc/Font-Report-June2016/CP437-Lucida.txt +633 -0
  25. package/deps/winpty/misc/Font-Report-June2016/CP932.txt +630 -0
  26. package/deps/winpty/misc/Font-Report-June2016/CP936.txt +630 -0
  27. package/deps/winpty/misc/Font-Report-June2016/CP949.txt +630 -0
  28. package/deps/winpty/misc/Font-Report-June2016/CP950.txt +630 -0
  29. package/deps/winpty/misc/Font-Report-June2016/MinimumWindowWidths.txt +16 -0
  30. package/deps/winpty/misc/Font-Report-June2016/Results.txt +4 -0
  31. package/deps/winpty/misc/Font-Report-June2016/Windows10SetFontBugginess.txt +144 -0
  32. package/deps/winpty/misc/FontSurvey.cc +100 -0
  33. package/deps/winpty/misc/FormatChar.h +21 -0
  34. package/deps/winpty/misc/FreezePerfTest.cc +62 -0
  35. package/deps/winpty/misc/GetCh.cc +20 -0
  36. package/deps/winpty/misc/GetConsolePos.cc +41 -0
  37. package/deps/winpty/misc/GetFont.cc +261 -0
  38. package/deps/winpty/misc/IdentifyConsoleWindow.ps1 +51 -0
  39. package/deps/winpty/misc/IsNewConsole.cc +87 -0
  40. package/deps/winpty/misc/MouseInputNotes.txt +90 -0
  41. package/deps/winpty/misc/MoveConsoleWindow.cc +34 -0
  42. package/deps/winpty/misc/Notes.txt +219 -0
  43. package/deps/winpty/misc/OSVersion.cc +27 -0
  44. package/deps/winpty/misc/ScreenBufferFreezeInactive.cc +101 -0
  45. package/deps/winpty/misc/ScreenBufferTest.cc +671 -0
  46. package/deps/winpty/misc/ScreenBufferTest2.cc +151 -0
  47. package/deps/winpty/misc/SelectAllTest.cc +45 -0
  48. package/deps/winpty/misc/SetBufferSize.cc +32 -0
  49. package/deps/winpty/misc/SetCursorPos.cc +10 -0
  50. package/deps/winpty/misc/SetFont.cc +145 -0
  51. package/deps/winpty/misc/SetWindowRect.cc +36 -0
  52. package/deps/winpty/misc/ShowArgv.cc +12 -0
  53. package/deps/winpty/misc/ShowConsoleInput.cc +40 -0
  54. package/deps/winpty/misc/Spew.py +5 -0
  55. package/deps/winpty/misc/TestUtil.cc +172 -0
  56. package/deps/winpty/misc/UnicodeDoubleWidthTest.cc +102 -0
  57. package/deps/winpty/misc/UnicodeWideTest1.cc +246 -0
  58. package/deps/winpty/misc/UnicodeWideTest2.cc +130 -0
  59. package/deps/winpty/misc/UnixEcho.cc +89 -0
  60. package/deps/winpty/misc/Utf16Echo.cc +46 -0
  61. package/deps/winpty/misc/VeryLargeRead.cc +122 -0
  62. package/deps/winpty/misc/VkEscapeTest.cc +56 -0
  63. package/deps/winpty/misc/Win10ResizeWhileFrozen.cc +52 -0
  64. package/deps/winpty/misc/Win10WrapTest1.cc +57 -0
  65. package/deps/winpty/misc/Win10WrapTest2.cc +30 -0
  66. package/deps/winpty/misc/Win32Echo1.cc +26 -0
  67. package/deps/winpty/misc/Win32Echo2.cc +19 -0
  68. package/deps/winpty/misc/Win32Test1.cc +46 -0
  69. package/deps/winpty/misc/Win32Test2.cc +70 -0
  70. package/deps/winpty/misc/Win32Test3.cc +78 -0
  71. package/deps/winpty/misc/Win32Write1.cc +44 -0
  72. package/deps/winpty/misc/WindowsBugCrashReader.cc +27 -0
  73. package/deps/winpty/misc/WriteConsole.cc +106 -0
  74. package/deps/winpty/misc/build32.sh +9 -0
  75. package/deps/winpty/misc/build64.sh +9 -0
  76. package/deps/winpty/misc/color-test.sh +212 -0
  77. package/deps/winpty/misc/font-notes.txt +300 -0
  78. package/deps/winpty/misc/winbug-15048.cc +201 -0
  79. package/deps/winpty/ship/build-pty4j-libpty.bat +36 -0
  80. package/deps/winpty/ship/common_ship.py +53 -0
  81. package/deps/winpty/ship/make_msvc_package.py +165 -0
  82. package/deps/winpty/ship/ship.py +108 -0
  83. package/deps/winpty/src/agent/Agent.cc +613 -0
  84. package/deps/winpty/src/agent/Agent.h +103 -0
  85. package/deps/winpty/src/agent/AgentCreateDesktop.cc +84 -0
  86. package/deps/winpty/src/agent/AgentCreateDesktop.h +28 -0
  87. package/deps/winpty/src/agent/ConsoleFont.cc +632 -0
  88. package/deps/winpty/src/agent/ConsoleFont.h +28 -0
  89. package/deps/winpty/src/agent/ConsoleInput.cc +852 -0
  90. package/deps/winpty/src/agent/ConsoleInput.h +109 -0
  91. package/deps/winpty/src/agent/ConsoleInputReencoding.cc +121 -0
  92. package/deps/winpty/src/agent/ConsoleInputReencoding.h +36 -0
  93. package/deps/winpty/src/agent/ConsoleLine.cc +152 -0
  94. package/deps/winpty/src/agent/ConsoleLine.h +41 -0
  95. package/deps/winpty/src/agent/Coord.h +87 -0
  96. package/deps/winpty/src/agent/DebugShowInput.cc +239 -0
  97. package/deps/winpty/src/agent/DebugShowInput.h +32 -0
  98. package/deps/winpty/src/agent/DefaultInputMap.cc +422 -0
  99. package/deps/winpty/src/agent/DefaultInputMap.h +28 -0
  100. package/deps/winpty/src/agent/DsrSender.h +30 -0
  101. package/deps/winpty/src/agent/EventLoop.cc +99 -0
  102. package/deps/winpty/src/agent/EventLoop.h +47 -0
  103. package/deps/winpty/src/agent/InputMap.cc +246 -0
  104. package/deps/winpty/src/agent/InputMap.h +114 -0
  105. package/deps/winpty/src/agent/LargeConsoleRead.cc +71 -0
  106. package/deps/winpty/src/agent/LargeConsoleRead.h +68 -0
  107. package/deps/winpty/src/agent/NamedPipe.cc +378 -0
  108. package/deps/winpty/src/agent/NamedPipe.h +125 -0
  109. package/deps/winpty/src/agent/Scraper.cc +699 -0
  110. package/deps/winpty/src/agent/Scraper.h +103 -0
  111. package/deps/winpty/src/agent/SimplePool.h +75 -0
  112. package/deps/winpty/src/agent/SmallRect.h +143 -0
  113. package/deps/winpty/src/agent/Terminal.cc +535 -0
  114. package/deps/winpty/src/agent/Terminal.h +69 -0
  115. package/deps/winpty/src/agent/UnicodeEncoding.h +157 -0
  116. package/deps/winpty/src/agent/UnicodeEncodingTest.cc +189 -0
  117. package/deps/winpty/src/agent/Win32Console.cc +107 -0
  118. package/deps/winpty/src/agent/Win32Console.h +67 -0
  119. package/deps/winpty/src/agent/Win32ConsoleBuffer.cc +193 -0
  120. package/deps/winpty/src/agent/Win32ConsoleBuffer.h +99 -0
  121. package/deps/winpty/src/agent/main.cc +114 -0
  122. package/deps/winpty/src/agent/subdir.mk +61 -0
  123. package/deps/winpty/src/configurations.gypi +60 -0
  124. package/deps/winpty/src/debugserver/DebugServer.cc +117 -0
  125. package/deps/winpty/src/debugserver/subdir.mk +41 -0
  126. package/deps/winpty/src/include/winpty.h +242 -0
  127. package/deps/winpty/src/include/winpty_constants.h +131 -0
  128. package/deps/winpty/src/libwinpty/AgentLocation.cc +75 -0
  129. package/deps/winpty/src/libwinpty/AgentLocation.h +28 -0
  130. package/deps/winpty/src/libwinpty/LibWinptyException.h +54 -0
  131. package/deps/winpty/src/libwinpty/WinptyInternal.h +72 -0
  132. package/deps/winpty/src/libwinpty/subdir.mk +46 -0
  133. package/deps/winpty/src/libwinpty/winpty.cc +970 -0
  134. package/deps/winpty/src/shared/AgentMsg.h +38 -0
  135. package/deps/winpty/src/shared/BackgroundDesktop.cc +122 -0
  136. package/deps/winpty/src/shared/BackgroundDesktop.h +73 -0
  137. package/deps/winpty/src/shared/Buffer.cc +103 -0
  138. package/deps/winpty/src/shared/Buffer.h +102 -0
  139. package/deps/winpty/src/shared/DebugClient.cc +187 -0
  140. package/deps/winpty/src/shared/DebugClient.h +38 -0
  141. package/deps/winpty/src/shared/GenRandom.cc +138 -0
  142. package/deps/winpty/src/shared/GenRandom.h +55 -0
  143. package/deps/winpty/src/shared/GetCommitHash.bat +13 -0
  144. package/deps/winpty/src/shared/Mutex.h +54 -0
  145. package/deps/winpty/src/shared/OsModule.h +63 -0
  146. package/deps/winpty/src/shared/OwnedHandle.cc +36 -0
  147. package/deps/winpty/src/shared/OwnedHandle.h +45 -0
  148. package/deps/winpty/src/shared/PrecompiledHeader.h +43 -0
  149. package/deps/winpty/src/shared/StringBuilder.h +227 -0
  150. package/deps/winpty/src/shared/StringBuilderTest.cc +114 -0
  151. package/deps/winpty/src/shared/StringUtil.cc +55 -0
  152. package/deps/winpty/src/shared/StringUtil.h +80 -0
  153. package/deps/winpty/src/shared/TimeMeasurement.h +63 -0
  154. package/deps/winpty/src/shared/UnixCtrlChars.h +45 -0
  155. package/deps/winpty/src/shared/UpdateGenVersion.bat +20 -0
  156. package/deps/winpty/src/shared/WindowsSecurity.cc +460 -0
  157. package/deps/winpty/src/shared/WindowsSecurity.h +104 -0
  158. package/deps/winpty/src/shared/WindowsVersion.cc +252 -0
  159. package/deps/winpty/src/shared/WindowsVersion.h +29 -0
  160. package/deps/winpty/src/shared/WinptyAssert.cc +55 -0
  161. package/deps/winpty/src/shared/WinptyAssert.h +64 -0
  162. package/deps/winpty/src/shared/WinptyException.cc +57 -0
  163. package/deps/winpty/src/shared/WinptyException.h +43 -0
  164. package/deps/winpty/src/shared/WinptyVersion.cc +42 -0
  165. package/deps/winpty/src/shared/WinptyVersion.h +27 -0
  166. package/deps/winpty/src/shared/winpty_snprintf.h +99 -0
  167. package/deps/winpty/src/subdir.mk +5 -0
  168. package/deps/winpty/src/tests/subdir.mk +28 -0
  169. package/deps/winpty/src/tests/trivial_test.cc +158 -0
  170. package/deps/winpty/src/unix-adapter/InputHandler.cc +114 -0
  171. package/deps/winpty/src/unix-adapter/InputHandler.h +56 -0
  172. package/deps/winpty/src/unix-adapter/OutputHandler.cc +80 -0
  173. package/deps/winpty/src/unix-adapter/OutputHandler.h +53 -0
  174. package/deps/winpty/src/unix-adapter/Util.cc +86 -0
  175. package/deps/winpty/src/unix-adapter/Util.h +31 -0
  176. package/deps/winpty/src/unix-adapter/WakeupFd.cc +70 -0
  177. package/deps/winpty/src/unix-adapter/WakeupFd.h +42 -0
  178. package/deps/winpty/src/unix-adapter/main.cc +729 -0
  179. package/deps/winpty/src/unix-adapter/subdir.mk +41 -0
  180. package/deps/winpty/src/winpty.gyp +234 -0
  181. package/deps/winpty/vcbuild.bat +83 -0
  182. package/lib/conpty_console_list_agent.js +16 -0
  183. package/lib/conpty_console_list_agent.js.map +1 -0
  184. package/lib/eventEmitter2.js +47 -0
  185. package/lib/eventEmitter2.js.map +1 -0
  186. package/lib/eventEmitter2.test.js +30 -0
  187. package/lib/eventEmitter2.test.js.map +1 -0
  188. package/lib/index.js +52 -0
  189. package/lib/index.js.map +1 -0
  190. package/lib/interfaces.js +7 -0
  191. package/lib/interfaces.js.map +1 -0
  192. package/lib/shared/conout.js +11 -0
  193. package/lib/shared/conout.js.map +1 -0
  194. package/lib/terminal.js +190 -0
  195. package/lib/terminal.js.map +1 -0
  196. package/lib/terminal.test.js +139 -0
  197. package/lib/terminal.test.js.map +1 -0
  198. package/lib/testUtils.test.js +28 -0
  199. package/lib/testUtils.test.js.map +1 -0
  200. package/lib/types.js +7 -0
  201. package/lib/types.js.map +1 -0
  202. package/lib/unixTerminal.js +346 -0
  203. package/lib/unixTerminal.js.map +1 -0
  204. package/lib/unixTerminal.test.js +351 -0
  205. package/lib/unixTerminal.test.js.map +1 -0
  206. package/lib/utils.js +39 -0
  207. package/lib/utils.js.map +1 -0
  208. package/lib/windowsConoutConnection.js +125 -0
  209. package/lib/windowsConoutConnection.js.map +1 -0
  210. package/lib/windowsPtyAgent.js +320 -0
  211. package/lib/windowsPtyAgent.js.map +1 -0
  212. package/lib/windowsPtyAgent.test.js +90 -0
  213. package/lib/windowsPtyAgent.test.js.map +1 -0
  214. package/lib/windowsTerminal.js +199 -0
  215. package/lib/windowsTerminal.js.map +1 -0
  216. package/lib/windowsTerminal.test.js +219 -0
  217. package/lib/windowsTerminal.test.js.map +1 -0
  218. package/lib/worker/conoutSocketWorker.js +22 -0
  219. package/lib/worker/conoutSocketWorker.js.map +1 -0
  220. package/package.json +68 -0
  221. package/prebuilds/darwin-arm64/pty.node +0 -0
  222. package/prebuilds/darwin-arm64/spawn-helper +0 -0
  223. package/prebuilds/darwin-x64/pty.node +0 -0
  224. package/prebuilds/darwin-x64/spawn-helper +0 -0
  225. package/prebuilds/win32-arm64/conpty/OpenConsole.exe +0 -0
  226. package/prebuilds/win32-arm64/conpty/conpty.dll +0 -0
  227. package/prebuilds/win32-arm64/conpty.node +0 -0
  228. package/prebuilds/win32-arm64/conpty.pdb +0 -0
  229. package/prebuilds/win32-arm64/conpty_console_list.node +0 -0
  230. package/prebuilds/win32-arm64/conpty_console_list.pdb +0 -0
  231. package/prebuilds/win32-arm64/pty.node +0 -0
  232. package/prebuilds/win32-arm64/pty.pdb +0 -0
  233. package/prebuilds/win32-arm64/winpty-agent.exe +0 -0
  234. package/prebuilds/win32-arm64/winpty-agent.pdb +0 -0
  235. package/prebuilds/win32-arm64/winpty.dll +0 -0
  236. package/prebuilds/win32-arm64/winpty.pdb +0 -0
  237. package/prebuilds/win32-x64/conpty/OpenConsole.exe +0 -0
  238. package/prebuilds/win32-x64/conpty/conpty.dll +0 -0
  239. package/prebuilds/win32-x64/conpty.node +0 -0
  240. package/prebuilds/win32-x64/conpty.pdb +0 -0
  241. package/prebuilds/win32-x64/conpty_console_list.node +0 -0
  242. package/prebuilds/win32-x64/conpty_console_list.pdb +0 -0
  243. package/prebuilds/win32-x64/pty.node +0 -0
  244. package/prebuilds/win32-x64/pty.pdb +0 -0
  245. package/prebuilds/win32-x64/winpty-agent.exe +0 -0
  246. package/prebuilds/win32-x64/winpty-agent.pdb +0 -0
  247. package/prebuilds/win32-x64/winpty.dll +0 -0
  248. package/prebuilds/win32-x64/winpty.pdb +0 -0
  249. package/scripts/gen-compile-commands.js +8 -0
  250. package/scripts/increment-version.js +54 -0
  251. package/scripts/post-install.js +99 -0
  252. package/scripts/prebuild.js +39 -0
  253. package/scripts/sync-prebuild.js +31 -0
  254. package/scripts/verify-darwin-fd-leak.js +63 -0
  255. package/src/conpty_console_list_agent.ts +15 -0
  256. package/src/eventEmitter2.test.ts +30 -0
  257. package/src/eventEmitter2.ts +48 -0
  258. package/src/index.ts +52 -0
  259. package/src/interfaces.ts +130 -0
  260. package/src/native.d.ts +54 -0
  261. package/src/shared/conout.ts +15 -0
  262. package/src/terminal.test.ts +119 -0
  263. package/src/terminal.ts +211 -0
  264. package/src/testUtils.test.ts +23 -0
  265. package/src/tsconfig.json +22 -0
  266. package/src/types.ts +15 -0
  267. package/src/unix/pty.cc +808 -0
  268. package/src/unix/spawn-helper.cc +23 -0
  269. package/src/unixTerminal.test.ts +367 -0
  270. package/src/unixTerminal.ts +388 -0
  271. package/src/utils.ts +29 -0
  272. package/src/win/conpty.cc +583 -0
  273. package/src/win/conpty.h +41 -0
  274. package/src/win/conpty_console_list.cc +44 -0
  275. package/src/win/path_util.cc +95 -0
  276. package/src/win/path_util.h +26 -0
  277. package/src/win/winpty.cc +333 -0
  278. package/src/windowsConoutConnection.ts +82 -0
  279. package/src/windowsPtyAgent.test.ts +94 -0
  280. package/src/windowsPtyAgent.ts +321 -0
  281. package/src/windowsTerminal.test.ts +229 -0
  282. package/src/windowsTerminal.ts +203 -0
  283. package/src/worker/conoutSocketWorker.ts +22 -0
  284. package/third_party/conpty/1.23.251008001/win10-arm64/OpenConsole.exe +0 -0
  285. package/third_party/conpty/1.23.251008001/win10-arm64/conpty.dll +0 -0
  286. package/third_party/conpty/1.23.251008001/win10-x64/OpenConsole.exe +0 -0
  287. package/third_party/conpty/1.23.251008001/win10-x64/conpty.dll +0 -0
  288. package/typings/node-pty.d.ts +211 -0
@@ -0,0 +1,151 @@
1
+ # winpty
2
+
3
+ [![Build Status](https://tea-ci.org/api/badges/rprichard/winpty/status.svg)](https://tea-ci.org/rprichard/winpty)
4
+
5
+ winpty is a Windows software package providing an interface similar to a Unix
6
+ pty-master for communicating with Windows console programs. The package
7
+ consists of a library (libwinpty) and a tool for Cygwin and MSYS for running
8
+ Windows console programs in a Cygwin/MSYS pty.
9
+
10
+ The software works by starting the `winpty-agent.exe` process with a new,
11
+ hidden console window, which bridges between the console API and terminal
12
+ input/output escape codes. It polls the hidden console's screen buffer for
13
+ changes and generates a corresponding stream of output.
14
+
15
+ The Unix adapter allows running Windows console programs (e.g. CMD, PowerShell,
16
+ IronPython, etc.) under `mintty` or Cygwin's `sshd` with
17
+ properly-functioning input (e.g. arrow and function keys) and output (e.g. line
18
+ buffering). The library could be also useful for writing a non-Cygwin SSH
19
+ server.
20
+
21
+ ## Supported Windows versions
22
+
23
+ winpty runs on Windows XP through Windows 10, including server versions. It
24
+ can be compiled into either 32-bit or 64-bit binaries.
25
+
26
+ ## Cygwin/MSYS adapter (`winpty.exe`)
27
+
28
+ ### Prerequisites
29
+
30
+ You need the following to build winpty:
31
+
32
+ * A Cygwin or MSYS installation
33
+ * GNU make
34
+ * A MinGW g++ toolchain capable of compiling C++11 code to build `winpty.dll`
35
+ and `winpty-agent.exe`
36
+ * A g++ toolchain targeting Cygwin or MSYS to build `winpty.exe`
37
+
38
+ Winpty requires two g++ toolchains as it is split into two parts. The
39
+ `winpty.dll` and `winpty-agent.exe` binaries interface with the native
40
+ Windows command prompt window so they are compiled with the native MinGW
41
+ toolchain. The `winpty.exe` binary interfaces with the MSYS/Cygwin terminal so
42
+ it is compiled with the MSYS/Cygwin toolchain.
43
+
44
+ MinGW appears to be split into two distributions -- MinGW (creates 32-bit
45
+ binaries) and MinGW-w64 (creates both 32-bit and 64-bit binaries). Either
46
+ one is generally acceptable.
47
+
48
+ #### Cygwin packages
49
+
50
+ The default g++ compiler for Cygwin targets Cygwin itself, but Cygwin also
51
+ packages MinGW-w64 compilers. As of this writing, the necessary packages are:
52
+
53
+ * Either `mingw64-i686-gcc-g++` or `mingw64-x86_64-gcc-g++`. Select the
54
+ appropriate compiler for your CPU architecture.
55
+ * `gcc-g++`
56
+ * `make`
57
+
58
+ As of this writing (2016-01-23), only the MinGW-w64 compiler is acceptable.
59
+ The MinGW compiler (e.g. from the `mingw-gcc-g++` package) is no longer
60
+ maintained and is too buggy.
61
+
62
+ #### MSYS packages
63
+
64
+ For the original MSYS, use the `mingw-get` tool (MinGW Installation Manager),
65
+ and select at least these components:
66
+
67
+ * `mingw-developer-toolkit`
68
+ * `mingw32-base`
69
+ * `mingw32-gcc-g++`
70
+ * `msys-base`
71
+ * `msys-system-builder`
72
+
73
+ When running `./configure`, make sure that `mingw32-g++` is in your
74
+ `PATH`. It will be in the `C:\MinGW\bin` directory.
75
+
76
+ #### MSYS2 packages
77
+
78
+ For MSYS2, use `pacman` and install at least these packages:
79
+
80
+ * `msys/gcc`
81
+ * `mingw32/mingw-w64-i686-gcc` or `mingw64/mingw-w64-x86_64-gcc`. Select
82
+ the appropriate compiler for your CPU architecture.
83
+ * `make`
84
+
85
+ MSYS2 provides three start menu shortcuts for starting MSYS2:
86
+
87
+ * MinGW-w64 Win32 Shell
88
+ * MinGW-w64 Win64 Shell
89
+ * MSYS2 Shell
90
+
91
+ To build winpty, use the MinGW-w64 {Win32,Win64} shortcut of the architecture
92
+ matching MSYS2. These shortcuts will put the g++ compiler from the
93
+ `{mingw32,mingw64}/mingw-w64-{i686,x86_64}-gcc` packages into the `PATH`.
94
+
95
+ Alternatively, instead of installing `mingw32/mingw-w64-i686-gcc` or
96
+ `mingw64/mingw-w64-x86_64-gcc`, install the `mingw-w64-cross-gcc` and
97
+ `mingw-w64-cross-crt-git` packages. These packages install cross-compilers
98
+ into `/opt/bin`, and then any of the three shortcuts will work.
99
+
100
+ ### Building the Unix adapter
101
+
102
+ In the project directory, run `./configure`, then `make`, then `make install`.
103
+ By default, winpty is installed into `/usr/local`. Pass `PREFIX=<path>` to
104
+ `make install` to override this default.
105
+
106
+ ### Using the Unix adapter
107
+
108
+ To run a Windows console program in `mintty` or Cygwin `sshd`, prepend
109
+ `winpty` to the command-line:
110
+
111
+ $ winpty powershell
112
+ Windows PowerShell
113
+ Copyright (C) 2009 Microsoft Corporation. All rights reserved.
114
+
115
+ PS C:\rprichard\proj\winpty> 10 + 20
116
+ 30
117
+ PS C:\rprichard\proj\winpty> exit
118
+
119
+ ## Embedding winpty / MSVC compilation
120
+
121
+ See `src/include/winpty.h` for the prototypes of functions exported by
122
+ `winpty.dll`.
123
+
124
+ Only the `winpty.exe` binary uses Cygwin; all the other binaries work without
125
+ it and can be compiled with either MinGW or MSVC. To compile using MSVC,
126
+ download gyp and run `gyp -I configurations.gypi` in the `src` subdirectory.
127
+ This will generate a `winpty.sln` and associated project files. See the
128
+ `src/winpty.gyp` and `src/configurations.gypi` files for notes on dealing with
129
+ MSVC versions and different architectures.
130
+
131
+ Compiling winpty with MSVC currently requires MSVC 2013 or newer.
132
+
133
+ ## Debugging winpty
134
+
135
+ winpty comes with a tool for collecting timestamped debugging output. To use
136
+ it:
137
+
138
+ 1. Run `winpty-debugserver.exe` on the same computer as winpty.
139
+ 2. Set the `WINPTY_DEBUG` environment variable to `trace` for the
140
+ `winpty.exe` process and/or the process using `libwinpty.dll`.
141
+
142
+ winpty also recognizes a `WINPTY_SHOW_CONSOLE` environment variable. Set it
143
+ to 1 to prevent winpty from hiding the console window.
144
+
145
+ ## Copyright
146
+
147
+ This project is distributed under the MIT license (see the `LICENSE` file in
148
+ the project root).
149
+
150
+ By submitting a pull request for this project, you agree to license your
151
+ contribution under the MIT license to this project.
@@ -0,0 +1,280 @@
1
+ # Next Version
2
+
3
+ Input handling changes:
4
+
5
+ * Improve Ctrl-C handling with programs that use unprocessed input. (e.g.
6
+ Ctrl-C now cancels input with PowerShell on Windows 10.)
7
+ [#116](https://github.com/rprichard/winpty/issues/116)
8
+ * Fix a theoretical issue with input event ordering.
9
+ [#117](https://github.com/rprichard/winpty/issues/117)
10
+ * Ctrl/Shift+{Arrow,Home,End} keys now work with IntelliJ.
11
+ [#118](https://github.com/rprichard/winpty/issues/118)
12
+
13
+ # Version 0.4.3 (2017-05-17)
14
+
15
+ Input handling changes:
16
+
17
+ * winpty sets `ENHANCED_KEY` for arrow and navigation keys. This fixes an
18
+ issue with the Ruby REPL.
19
+ [#99](https://github.com/rprichard/winpty/issues/99)
20
+ * AltGr keys are handled better now.
21
+ [#109](https://github.com/rprichard/winpty/issues/109)
22
+ * In `ENABLE_VIRTUAL_TERMINAL_INPUT` mode, when typing Home/End with a
23
+ modifier (e.g. Ctrl), winpty now generates an H/F escape sequence like
24
+ `^[[1;5F` rather than a 1/4 escape like `^[[4;5~`.
25
+ [#114](https://github.com/rprichard/winpty/issues/114)
26
+
27
+ Resizing and scraping fixes:
28
+
29
+ * winpty now synthesizes a `WINDOW_BUFFER_SIZE_EVENT` event after resizing
30
+ the console to better propagate window size changes to console programs.
31
+ In particular, this affects WSL and Cygwin.
32
+ [#110](https://github.com/rprichard/winpty/issues/110)
33
+ * Better handling of resizing for certain full-screen programs, like
34
+ WSL less.
35
+ [#112](https://github.com/rprichard/winpty/issues/112)
36
+ * Hide the cursor if it's currently outside the console window. This change
37
+ fixes an issue with Far Manager.
38
+ [#113](https://github.com/rprichard/winpty/issues/113)
39
+ * winpty now avoids using console fonts smaller than 5px high to improve
40
+ half-vs-full-width character handling. See
41
+ https://github.com/Microsoft/vscode/issues/19665.
42
+ [b4db322010](https://github.com/rprichard/winpty/commit/b4db322010d2d897e6c496fefc4f0ecc9b84c2f3)
43
+
44
+ Cygwin/MSYS adapter fix:
45
+
46
+ * The way the `winpty` Cygwin/MSYS2 adapter searches for the program to
47
+ launch changed. It now resolves symlinks and searches the PATH explicitly.
48
+ [#81](https://github.com/rprichard/winpty/issues/81)
49
+ [#98](https://github.com/rprichard/winpty/issues/98)
50
+
51
+ This release does not include binaries for the old MSYS1 project anymore.
52
+ MSYS2 will continue to be supported. See
53
+ https://github.com/rprichard/winpty/issues/97.
54
+
55
+ # Version 0.4.2 (2017-01-18)
56
+
57
+ This release improves WSL support (i.e. Bash-on-Windows):
58
+
59
+ * winpty generates more correct input escape sequences for WSL programs that
60
+ enable an alternate input mode using DECCKM. This bug affected arrow keys
61
+ and Home/End in WSL programs such as `vim`, `mc`, and `less`.
62
+ [#90](https://github.com/rprichard/winpty/issues/90)
63
+ * winpty now recognizes the `COMMON_LVB_REVERSE_VIDEO` and
64
+ `COMMON_LVB_UNDERSCORE` text attributes. The Windows console uses these
65
+ attributes to implement the SGR.4(Underline) and SGR.7(Negative) modes in
66
+ its VT handling. This change affects WSL pager status bars, man pages, etc.
67
+
68
+ The build system no longer has a "version suffix" mechanism, so passing
69
+ `VERSION_SUFFIX=<suffix>` to make or `-D VERSION_SUFFIX=<suffix>` to gyp now
70
+ has no effect. AFAIK, the mechanism was never used publicly.
71
+ [67a34b6c03](https://github.com/rprichard/winpty/commit/67a34b6c03557a5c2e0a2bdd502c2210921d8f3e)
72
+
73
+ # Version 0.4.1 (2017-01-03)
74
+
75
+ Bug fixes:
76
+
77
+ * This version fixes a bug where the `winpty-agent.exe` process could read
78
+ past the end of a buffer.
79
+ [#94](https://github.com/rprichard/winpty/issues/94)
80
+
81
+ # Version 0.4.0 (2016-06-28)
82
+
83
+ The winpty library has a new API that should be easier for embedding.
84
+ [880c00c69e](https://github.com/rprichard/winpty/commit/880c00c69eeca73643ddb576f02c5badbec81f56)
85
+
86
+ User-visible changes:
87
+
88
+ * winpty now automatically puts the terminal into mouse mode when it detects
89
+ that the console has left QuickEdit mode. The `--mouse` option still forces
90
+ the terminal into mouse mode. In principle, an option could be added to
91
+ suppress terminal mode, but hopefully it won't be necessary. There is a
92
+ script in the `misc` subdirectory, `misc/ConinMode.ps1`, that can change
93
+ the QuickEdit mode from the command-line.
94
+ * winpty now passes keyboard escapes to `bash.exe` in the Windows Subsystem
95
+ for Linux.
96
+ [#82](https://github.com/rprichard/winpty/issues/82)
97
+
98
+ Bug fixes:
99
+
100
+ * By default, `winpty.dll` avoids calling `SetProcessWindowStation` within
101
+ the calling process.
102
+ [#58](https://github.com/rprichard/winpty/issues/58)
103
+ * Fixed an uninitialized memory bug that could have crashed winpty.
104
+ [#80](https://github.com/rprichard/winpty/issues/80)
105
+ * winpty now works better with very large and very small terminal windows.
106
+ It resizes the console font according to the number of columns.
107
+ [#61](https://github.com/rprichard/winpty/issues/61)
108
+ * winpty no longer uses Mark to freeze the console on Windows 10. The Mark
109
+ command could interfere with the cursor position, corrupting the data in
110
+ the screen buffer.
111
+ [#79](https://github.com/rprichard/winpty/issues/79)
112
+
113
+ # Version 0.3.0 (2016-05-20)
114
+
115
+ User-visible changes:
116
+
117
+ * The UNIX adapter is renamed from `console.exe` to `winpty.exe` to be
118
+ consistent with MSYS2. The name `winpty.exe` is less likely to conflict
119
+ with another program and is easier to search for online (e.g. for someone
120
+ unfamiliar with winpty).
121
+ * The UNIX adapter now clears the `TERM` variable.
122
+ [#43](https://github.com/rprichard/winpty/issues/43)
123
+ * An escape character appearing in a console screen buffer cell is converted
124
+ to a '?'.
125
+ [#47](https://github.com/rprichard/winpty/issues/47)
126
+
127
+ Bug fixes:
128
+
129
+ * A major bug affecting XP users was fixed.
130
+ [#67](https://github.com/rprichard/winpty/issues/67)
131
+ * Fixed an incompatibility with ConEmu where winpty hung if ConEmu's
132
+ "Process 'start'" feature was enabled.
133
+ [#70](https://github.com/rprichard/winpty/issues/70)
134
+ * Fixed a bug where `cmd.exe` sometimes printed the message,
135
+ `Not enough storage is available to process this command.`.
136
+ [#74](https://github.com/rprichard/winpty/issues/74)
137
+
138
+ Many changes internally:
139
+
140
+ * The codebase is switched from C++03 to C++11 and uses exceptions internally.
141
+ No exceptions are thrown across the C APIs defined in `winpty.h`.
142
+ * This version drops support for the original MinGW compiler packaged with
143
+ Cygwin (`i686-pc-mingw32-g++`). The MinGW-w64 compiler is still supported,
144
+ as is the MinGW distributed at mingw.org. Compiling with MSVC now requires
145
+ MSVC 2013 or newer. Windows XP is still supported.
146
+ [ec3eae8df5](https://github.com/rprichard/winpty/commit/ec3eae8df5bbbb36d7628d168b0815638d122f37)
147
+ * Pipe security is improved. winpty works harder to produce unique pipe names
148
+ and includes a random component in the name. winpty secures pipes with a
149
+ DACL that prevents arbitrary users from connecting to its pipes. winpty now
150
+ passes `PIPE_REJECT_REMOTE_CLIENTS` on Vista and up, and it verifies that
151
+ the pipe client PID is correct, again on Vista and up. When connecting to a
152
+ named pipe, winpty uses the `SECURITY_IDENTIFICATION` flag to restrict
153
+ impersonation. Previous versions *should* still be secure.
154
+ * `winpty-debugserver.exe` now has an `--everyone` flag that allows capturing
155
+ debug output from other users.
156
+ * The code now compiles cleanly with MSVC's "Security Development Lifecycle"
157
+ (`/SDL`) checks enabled.
158
+
159
+ # Version 0.2.2 (2016-02-25)
160
+
161
+ Minor bug fixes and enhancements:
162
+
163
+ * Fix a bug that generated spurious mouse input records when an incomplete
164
+ mouse escape sequence was seen.
165
+ * Fix a buffer overflow bug in `winpty-debugserver.exe` affecting messages of
166
+ exactly 4096 bytes.
167
+ * For MSVC builds, add a `src/configurations.gypi` file that can be included
168
+ on the gyp command-line to enable 32-bit and 64-bit builds.
169
+ * `winpty-agent --show-input` mode: Flush stdout after each line.
170
+ * Makefile builds: generate a `build/winpty.lib` import library to accompany
171
+ `build/winpty.dll`.
172
+
173
+ # Version 0.2.1 (2015-12-19)
174
+
175
+ * The main project source was moved into a `src` directory for better code
176
+ organization and to fix
177
+ [#51](https://github.com/rprichard/winpty/issues/51).
178
+ * winpty recognizes many more escape sequences, including:
179
+ * putty/rxvt's F1-F4 keys
180
+ [#40](https://github.com/rprichard/winpty/issues/40)
181
+ * the Linux virtual console's F1-F5 keys
182
+ * the "application numpad" keys (e.g. enabled with DECPAM)
183
+ * Fixed handling of Shift-Alt-O and Alt-[.
184
+ * Added support for mouse input. The UNIX adapter has a `--mouse` argument
185
+ that puts the terminal into mouse mode, but the agent recognizes mouse
186
+ input even without the argument. The agent recognizes double-clicks using
187
+ Windows' double-click interval setting (i.e. GetDoubleClickTime).
188
+ [#57](https://github.com/rprichard/winpty/issues/57)
189
+
190
+ Changes to debugging interfaces:
191
+
192
+ * The `WINPTY_DEBUG` variable is now a comma-separated list. The old
193
+ behavior (i.e. tracing) is enabled with `WINPTY_DEBUG=trace`.
194
+ * The UNIX adapter program now has a `--showkey` argument that dumps input
195
+ bytes.
196
+ * The `winpty-agent.exe` program has a `--show-input` argument that dumps
197
+ `INPUT_RECORD` records. (It omits mouse events unless `--with-mouse` is
198
+ also specified.) The agent also responds to `WINPTY_DEBUG=trace,input`,
199
+ which logs input bytes and synthesized console events, and it responds to
200
+ `WINPTY_DEBUG=trace,dump_input_map`, which dumps the internal table of
201
+ escape sequences.
202
+
203
+ # Version 0.2.0 (2015-11-13)
204
+
205
+ No changes to the API, but many small changes to the implementation. The big
206
+ changes include:
207
+
208
+ * Support for 64-bit Cygwin and MSYS2
209
+ * Support for Windows 10
210
+ * Better Unicode support (especially East Asian languages)
211
+
212
+ Details:
213
+
214
+ * The `configure` script recognizes 64-bit Cygwin and MSYS2 environments and
215
+ selects the appropriate compiler.
216
+ * winpty works much better with the upgraded console in Windows 10. The
217
+ `conhost.exe` hang can still occur, but only with certain programs, and
218
+ is much less likely to occur. With the new console, use Mark instead of
219
+ SelectAll, for better performance.
220
+ [#31](https://github.com/rprichard/winpty/issues/31)
221
+ [#30](https://github.com/rprichard/winpty/issues/30)
222
+ [#53](https://github.com/rprichard/winpty/issues/53)
223
+ * The UNIX adapter now calls `setlocale(LC_ALL, "")` to set the locale.
224
+ * Improved Unicode support. When a console is started with an East Asian code
225
+ page, winpty now chooses an East Asian font rather than Consolas / Lucida
226
+ Console. Selecting the right font helps synchronize character widths
227
+ between the console and terminal. (It's not perfect, though.)
228
+ [#41](https://github.com/rprichard/winpty/issues/41)
229
+ * winpty now more-or-less works with programs that change the screen buffer
230
+ or resize the original screen buffer. If the screen buffer height changes,
231
+ winpty switches to a "direct mode", where it makes no effort to track
232
+ scrolling. In direct mode, it merely syncs snapshots of the console to the
233
+ terminal. Caveats:
234
+ * Changing the screen buffer (i.e. `SetConsoleActiveScreenBuffer`)
235
+ breaks winpty on Windows 7. This problem can eventually be mitigated,
236
+ but never completely fixed, due to Windows 7 bugginess.
237
+ * Resizing the original screen buffer can hang `conhost.exe` on Windows 10.
238
+ Enabling the legacy console is a workaround.
239
+ * If a program changes the screen buffer and then exits, relying on the OS
240
+ to restore the original screen buffer, that restoration probably will not
241
+ happen with winpty. winpty's behavior can probably be improved here.
242
+ * Improved color handling:
243
+ * DkGray-on-Black text was previously hiddenly completely. Now it is
244
+ output as DkGray, with a fallback to LtGray on terminals that don't
245
+ recognize the intense colors.
246
+ [#39](https://github.com/rprichard/winpty/issues/39).
247
+ * The console is always initialized to LtGray-on-Black, regardless of the
248
+ user setting, which matches the console color heuristic, which translates
249
+ LtGray-on-Black to "reset SGR parameters."
250
+ * Shift-Tab is recognized correctly now.
251
+ [#19](https://github.com/rprichard/winpty/issues/19)
252
+ * Add a `--version` argument to `winpty-agent.exe` and the UNIX adapter. The
253
+ argument reports the nominal version (i.e. the `VERSION.txt`) file, with a
254
+ "VERSION_SUFFIX" appended (defaulted to `-dev`), and a git commit hash, if
255
+ the `git` command successfully reports a hash during the build. The `git`
256
+ command is invoked by either `make` or `gyp`.
257
+ * The agent now combines `ReadConsoleOutputW` calls when it polls the console
258
+ buffer for changes, which may slightly reduce its CPU overhead.
259
+ [#44](https://github.com/rprichard/winpty/issues/44).
260
+ * A `gyp` file is added to help compile with MSVC.
261
+ * The code can now be compiled as C++11 code, though it isn't by default.
262
+ [bde8922e08](https://github.com/rprichard/winpty/commit/bde8922e08c3638e01ecc7b581b676c314163e3c)
263
+ * If winpty can't create a new window station, it charges ahead rather than
264
+ aborting. This situation might happen if winpty were started from an SSH
265
+ session.
266
+ * Debugging improvements:
267
+ * `WINPTYDBG` is renamed to `WINPTY_DEBUG`, and a new `WINPTY_SHOW_CONSOLE`
268
+ variable keeps the underlying console visible.
269
+ * A `winpty-debugserver.exe` program is built and shipped by default. It
270
+ collects the trace output enabled with `WINPTY_DEBUG`.
271
+ * The `Makefile` build of winpty now compiles `winpty-agent.exe` and
272
+ `winpty.dll` with -O2.
273
+
274
+ # Version 0.1.1 (2012-07-28)
275
+
276
+ Minor bugfix release.
277
+
278
+ # Version 0.1 (2012-04-17)
279
+
280
+ Initial release.
@@ -0,0 +1 @@
1
+ 0.4.4-dev
@@ -0,0 +1,167 @@
1
+ #!/bin/bash
2
+ #
3
+ # Copyright (c) 2011-2015 Ryan Prichard
4
+ #
5
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ # of this software and associated documentation files (the "Software"), to
7
+ # deal in the Software without restriction, including without limitation the
8
+ # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
9
+ # sell copies of the Software, and to permit persons to whom the Software is
10
+ # furnished to do so, subject to the following conditions:
11
+ #
12
+ # The above copyright notice and this permission notice shall be included in
13
+ # all copies or substantial portions of the Software.
14
+ #
15
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20
+ # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21
+ # IN THE SOFTWARE.
22
+
23
+ #
24
+ # findTool(desc, commandList)
25
+ #
26
+ # Searches commandLine for the first command in the PATH and returns it.
27
+ # Prints an error and aborts the script if no match is found.
28
+ #
29
+ FINDTOOL_OUT=""
30
+ function findTool {
31
+ DESC=$1
32
+ OPTIONS=$2
33
+ for CMD in ${OPTIONS}; do
34
+ if (which $CMD &>/dev/null) then
35
+ echo "Found $DESC: $CMD"
36
+ FINDTOOL_OUT="$CMD"
37
+ return
38
+ fi
39
+ done
40
+ echo "Error: could not find $DESC. One of these should be in your PATH:"
41
+ for CMD in ${OPTIONS}; do
42
+ echo " * $CMD"
43
+ done
44
+ exit 1
45
+ }
46
+
47
+ IS_CYGWIN=0
48
+ IS_MSYS1=0
49
+ IS_MSYS2=0
50
+
51
+ # Link parts of the Cygwin binary statically to aid in redistribution? The
52
+ # binary still links dynamically against the main DLL. The MinGW binaries are
53
+ # also statically linked and therefore depend only on Windows DLLs. I started
54
+ # linking the Cygwin/MSYS binary statically, because G++ 4.7 changed the
55
+ # Windows C++ ABI.
56
+ UNIX_LDFLAGS_STATIC='-static -static-libgcc -static-libstdc++'
57
+
58
+ # Detect the environment -- Cygwin or MSYS.
59
+ case $(uname -s) in
60
+ CYGWIN*)
61
+ echo 'uname -s identifies a Cygwin environment.'
62
+ IS_CYGWIN=1
63
+ case $(uname -m) in
64
+ i686)
65
+ echo 'uname -m identifies an i686 environment.'
66
+ UNIX_CXX=i686-pc-cygwin-g++
67
+ MINGW_CXX=i686-w64-mingw32-g++
68
+ ;;
69
+ x86_64)
70
+ echo 'uname -m identifies an x86_64 environment.'
71
+ UNIX_CXX=x86_64-pc-cygwin-g++
72
+ MINGW_CXX=x86_64-w64-mingw32-g++
73
+ ;;
74
+ *)
75
+ echo 'Error: uname -m did not match either i686 or x86_64.'
76
+ exit 1
77
+ ;;
78
+ esac
79
+ ;;
80
+ MSYS*|MINGW*)
81
+ # MSYS2 notes:
82
+ # - MSYS2 offers two shortcuts to open an environment:
83
+ # - MinGW-w64 Win32 Shell. This env reports a `uname -s` of
84
+ # MINGW32_NT-6.1 on 32-bit Win7. The MinGW-w64 compiler
85
+ # (i686-w64-mingw32-g++.exe) is in the PATH.
86
+ # - MSYS2 Shell. `uname -s` instead reports MSYS_NT-6.1.
87
+ # The i686-w64-mingw32-g++ compiler is not in the PATH.
88
+ # - MSYS2 appears to use MinGW-w64, not the older mingw.org.
89
+ # MSYS notes:
90
+ # - `uname -s` is always MINGW32_NT-6.1 on Win7.
91
+ echo 'uname -s identifies an MSYS/MSYS2 environment.'
92
+ case $(uname -m) in
93
+ i686)
94
+ echo 'uname -m identifies an i686 environment.'
95
+ UNIX_CXX=i686-pc-msys-g++
96
+ if echo "$(uname -r)" | grep '^1[.]' > /dev/null; then
97
+ # The MSYS-targeting compiler for the original 32-bit-only
98
+ # MSYS does not recognize the -static-libstdc++ flag, and
99
+ # it does not work with -static, because it tries to link
100
+ # statically with the core MSYS library and fails.
101
+ #
102
+ # Distinguish between the two using the major version
103
+ # number of `uname -r`:
104
+ #
105
+ # MSYS uname -r: 1.0.18(0.48/3/2)
106
+ # MSYS2 uname -r: 2.0.0(0.284/5/3)
107
+ #
108
+ # This is suboptimal because MSYS2 is not actually the
109
+ # second version of MSYS--it's a brand-new fork of Cygwin.
110
+ #
111
+ IS_MSYS1=1
112
+ UNIX_LDFLAGS_STATIC=
113
+ MINGW_CXX=mingw32-g++
114
+ else
115
+ IS_MSYS2=1
116
+ MINGW_CXX=i686-w64-mingw32-g++.exe
117
+ fi
118
+ ;;
119
+ x86_64)
120
+ echo 'uname -m identifies an x86_64 environment.'
121
+ IS_MSYS2=1
122
+ UNIX_CXX=x86_64-pc-msys-g++
123
+ MINGW_CXX=x86_64-w64-mingw32-g++
124
+ ;;
125
+ *)
126
+ echo 'Error: uname -m did not match either i686 or x86_64.'
127
+ exit 1
128
+ ;;
129
+ esac
130
+ ;;
131
+ *)
132
+ echo 'Error: uname -s did not match either CYGWIN* or MINGW*.'
133
+ exit 1
134
+ ;;
135
+ esac
136
+
137
+ # Search the PATH and pick the first match.
138
+ findTool "Cygwin/MSYS G++ compiler" "$UNIX_CXX"
139
+ UNIX_CXX=$FINDTOOL_OUT
140
+ findTool "MinGW G++ compiler" "$MINGW_CXX"
141
+ MINGW_CXX=$FINDTOOL_OUT
142
+
143
+ # Write config files.
144
+ echo Writing config.mk
145
+ echo UNIX_CXX=$UNIX_CXX > config.mk
146
+ echo UNIX_LDFLAGS_STATIC=$UNIX_LDFLAGS_STATIC >> config.mk
147
+ echo MINGW_CXX=$MINGW_CXX >> config.mk
148
+
149
+ if test $IS_MSYS1 = 1; then
150
+ echo UNIX_CXXFLAGS += -DWINPTY_TARGET_MSYS1 >> config.mk
151
+ # The MSYS1 MinGW compiler has a bug that prevents inclusion of algorithm
152
+ # and math.h in normal C++11 mode. The workaround is to enable the gnu++11
153
+ # mode instead. The bug was fixed on 2015-07-31, but as of 2016-02-26, the
154
+ # fix apparently hasn't been released. See
155
+ # http://ehc.ac/p/mingw/bugs/2250/.
156
+ echo MINGW_ENABLE_CXX11_FLAG := -std=gnu++11 >> config.mk
157
+ fi
158
+
159
+ if test -d .git -a -f .git/HEAD -a -f .git/index && git rev-parse HEAD >&/dev/null; then
160
+ echo "Commit info: git"
161
+ echo 'COMMIT_HASH = $(shell git rev-parse HEAD)' >> config.mk
162
+ echo 'COMMIT_HASH_DEP := config.mk .git/HEAD .git/index' >> config.mk
163
+ else
164
+ echo "Commit info: none"
165
+ echo 'COMMIT_HASH := none' >> config.mk
166
+ echo 'COMMIT_HASH_DEP := config.mk' >> config.mk
167
+ fi
@@ -0,0 +1,90 @@
1
+ #include <windows.h>
2
+ #include <cassert>
3
+
4
+ #include "TestUtil.cc"
5
+
6
+ void dumpInfoToTrace() {
7
+ CONSOLE_SCREEN_BUFFER_INFO info;
8
+ assert(GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &info));
9
+ trace("win=(%d,%d,%d,%d)",
10
+ (int)info.srWindow.Left,
11
+ (int)info.srWindow.Top,
12
+ (int)info.srWindow.Right,
13
+ (int)info.srWindow.Bottom);
14
+ trace("buf=(%d,%d)",
15
+ (int)info.dwSize.X,
16
+ (int)info.dwSize.Y);
17
+ trace("cur=(%d,%d)",
18
+ (int)info.dwCursorPosition.X,
19
+ (int)info.dwCursorPosition.Y);
20
+ }
21
+
22
+ int main(int argc, char *argv[]) {
23
+ if (argc == 1) {
24
+ startChildProcess(L"CHILD");
25
+ return 0;
26
+ }
27
+
28
+ setWindowPos(0, 0, 1, 1);
29
+
30
+ if (false) {
31
+ // Reducing the buffer height can move the window up.
32
+ setBufferSize(80, 25);
33
+ setWindowPos(0, 20, 80, 5);
34
+ Sleep(2000);
35
+ setBufferSize(80, 10);
36
+ }
37
+
38
+ if (false) {
39
+ // Reducing the buffer height moves the window up and the buffer
40
+ // contents up too.
41
+ setBufferSize(80, 25);
42
+ setWindowPos(0, 20, 80, 5);
43
+ setCursorPos(0, 20);
44
+ printf("TEST1\nTEST2\nTEST3\nTEST4\n");
45
+ fflush(stdout);
46
+ Sleep(2000);
47
+ setBufferSize(80, 10);
48
+ }
49
+
50
+ if (false) {
51
+ // Reducing the buffer width can move the window left.
52
+ setBufferSize(80, 25);
53
+ setWindowPos(40, 0, 40, 25);
54
+ Sleep(2000);
55
+ setBufferSize(60, 25);
56
+ }
57
+
58
+ if (false) {
59
+ // Sometimes the buffer contents are shifted up; sometimes they're
60
+ // shifted down. It seems to depend on the cursor position?
61
+
62
+ // setBufferSize(80, 25);
63
+ // setWindowPos(0, 20, 80, 5);
64
+ // setCursorPos(0, 20);
65
+ // printf("TESTa\nTESTb\nTESTc\nTESTd\nTESTe");
66
+ // fflush(stdout);
67
+ // setCursorPos(0, 0);
68
+ // printf("TEST1\nTEST2\nTEST3\nTEST4\nTEST5");
69
+ // fflush(stdout);
70
+ // setCursorPos(0, 24);
71
+ // Sleep(5000);
72
+ // setBufferSize(80, 24);
73
+
74
+ setBufferSize(80, 20);
75
+ setWindowPos(0, 10, 80, 10);
76
+ setCursorPos(0, 18);
77
+
78
+ printf("TEST1\nTEST2");
79
+ fflush(stdout);
80
+ setCursorPos(0, 18);
81
+
82
+ Sleep(2000);
83
+ setBufferSize(80, 18);
84
+ }
85
+
86
+ dumpInfoToTrace();
87
+ Sleep(30000);
88
+
89
+ return 0;
90
+ }