@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.
- package/LICENSE +69 -0
- package/README.md +170 -0
- package/binding.gyp +111 -0
- package/deps/.editorconfig +2 -0
- package/deps/winpty/.drone.yml +17 -0
- package/deps/winpty/.gitattributes +19 -0
- package/deps/winpty/LICENSE +21 -0
- package/deps/winpty/Makefile +166 -0
- package/deps/winpty/README.md +151 -0
- package/deps/winpty/RELEASES.md +280 -0
- package/deps/winpty/VERSION.txt +1 -0
- package/deps/winpty/configure +167 -0
- package/deps/winpty/misc/BufferResizeTests.cc +90 -0
- package/deps/winpty/misc/ChangeScreenBuffer.cc +53 -0
- package/deps/winpty/misc/ClearConsole.cc +72 -0
- package/deps/winpty/misc/ConinMode.cc +117 -0
- package/deps/winpty/misc/ConinMode.ps1 +116 -0
- package/deps/winpty/misc/ConoutMode.cc +113 -0
- package/deps/winpty/misc/DebugClient.py +42 -0
- package/deps/winpty/misc/DebugServer.py +63 -0
- package/deps/winpty/misc/DumpLines.py +5 -0
- package/deps/winpty/misc/EnableExtendedFlags.txt +46 -0
- package/deps/winpty/misc/Font-Report-June2016/CP437-Consolas.txt +528 -0
- package/deps/winpty/misc/Font-Report-June2016/CP437-Lucida.txt +633 -0
- package/deps/winpty/misc/Font-Report-June2016/CP932.txt +630 -0
- package/deps/winpty/misc/Font-Report-June2016/CP936.txt +630 -0
- package/deps/winpty/misc/Font-Report-June2016/CP949.txt +630 -0
- package/deps/winpty/misc/Font-Report-June2016/CP950.txt +630 -0
- package/deps/winpty/misc/Font-Report-June2016/MinimumWindowWidths.txt +16 -0
- package/deps/winpty/misc/Font-Report-June2016/Results.txt +4 -0
- package/deps/winpty/misc/Font-Report-June2016/Windows10SetFontBugginess.txt +144 -0
- package/deps/winpty/misc/FontSurvey.cc +100 -0
- package/deps/winpty/misc/FormatChar.h +21 -0
- package/deps/winpty/misc/FreezePerfTest.cc +62 -0
- package/deps/winpty/misc/GetCh.cc +20 -0
- package/deps/winpty/misc/GetConsolePos.cc +41 -0
- package/deps/winpty/misc/GetFont.cc +261 -0
- package/deps/winpty/misc/IdentifyConsoleWindow.ps1 +51 -0
- package/deps/winpty/misc/IsNewConsole.cc +87 -0
- package/deps/winpty/misc/MouseInputNotes.txt +90 -0
- package/deps/winpty/misc/MoveConsoleWindow.cc +34 -0
- package/deps/winpty/misc/Notes.txt +219 -0
- package/deps/winpty/misc/OSVersion.cc +27 -0
- package/deps/winpty/misc/ScreenBufferFreezeInactive.cc +101 -0
- package/deps/winpty/misc/ScreenBufferTest.cc +671 -0
- package/deps/winpty/misc/ScreenBufferTest2.cc +151 -0
- package/deps/winpty/misc/SelectAllTest.cc +45 -0
- package/deps/winpty/misc/SetBufferSize.cc +32 -0
- package/deps/winpty/misc/SetCursorPos.cc +10 -0
- package/deps/winpty/misc/SetFont.cc +145 -0
- package/deps/winpty/misc/SetWindowRect.cc +36 -0
- package/deps/winpty/misc/ShowArgv.cc +12 -0
- package/deps/winpty/misc/ShowConsoleInput.cc +40 -0
- package/deps/winpty/misc/Spew.py +5 -0
- package/deps/winpty/misc/TestUtil.cc +172 -0
- package/deps/winpty/misc/UnicodeDoubleWidthTest.cc +102 -0
- package/deps/winpty/misc/UnicodeWideTest1.cc +246 -0
- package/deps/winpty/misc/UnicodeWideTest2.cc +130 -0
- package/deps/winpty/misc/UnixEcho.cc +89 -0
- package/deps/winpty/misc/Utf16Echo.cc +46 -0
- package/deps/winpty/misc/VeryLargeRead.cc +122 -0
- package/deps/winpty/misc/VkEscapeTest.cc +56 -0
- package/deps/winpty/misc/Win10ResizeWhileFrozen.cc +52 -0
- package/deps/winpty/misc/Win10WrapTest1.cc +57 -0
- package/deps/winpty/misc/Win10WrapTest2.cc +30 -0
- package/deps/winpty/misc/Win32Echo1.cc +26 -0
- package/deps/winpty/misc/Win32Echo2.cc +19 -0
- package/deps/winpty/misc/Win32Test1.cc +46 -0
- package/deps/winpty/misc/Win32Test2.cc +70 -0
- package/deps/winpty/misc/Win32Test3.cc +78 -0
- package/deps/winpty/misc/Win32Write1.cc +44 -0
- package/deps/winpty/misc/WindowsBugCrashReader.cc +27 -0
- package/deps/winpty/misc/WriteConsole.cc +106 -0
- package/deps/winpty/misc/build32.sh +9 -0
- package/deps/winpty/misc/build64.sh +9 -0
- package/deps/winpty/misc/color-test.sh +212 -0
- package/deps/winpty/misc/font-notes.txt +300 -0
- package/deps/winpty/misc/winbug-15048.cc +201 -0
- package/deps/winpty/ship/build-pty4j-libpty.bat +36 -0
- package/deps/winpty/ship/common_ship.py +53 -0
- package/deps/winpty/ship/make_msvc_package.py +165 -0
- package/deps/winpty/ship/ship.py +108 -0
- package/deps/winpty/src/agent/Agent.cc +613 -0
- package/deps/winpty/src/agent/Agent.h +103 -0
- package/deps/winpty/src/agent/AgentCreateDesktop.cc +84 -0
- package/deps/winpty/src/agent/AgentCreateDesktop.h +28 -0
- package/deps/winpty/src/agent/ConsoleFont.cc +632 -0
- package/deps/winpty/src/agent/ConsoleFont.h +28 -0
- package/deps/winpty/src/agent/ConsoleInput.cc +852 -0
- package/deps/winpty/src/agent/ConsoleInput.h +109 -0
- package/deps/winpty/src/agent/ConsoleInputReencoding.cc +121 -0
- package/deps/winpty/src/agent/ConsoleInputReencoding.h +36 -0
- package/deps/winpty/src/agent/ConsoleLine.cc +152 -0
- package/deps/winpty/src/agent/ConsoleLine.h +41 -0
- package/deps/winpty/src/agent/Coord.h +87 -0
- package/deps/winpty/src/agent/DebugShowInput.cc +239 -0
- package/deps/winpty/src/agent/DebugShowInput.h +32 -0
- package/deps/winpty/src/agent/DefaultInputMap.cc +422 -0
- package/deps/winpty/src/agent/DefaultInputMap.h +28 -0
- package/deps/winpty/src/agent/DsrSender.h +30 -0
- package/deps/winpty/src/agent/EventLoop.cc +99 -0
- package/deps/winpty/src/agent/EventLoop.h +47 -0
- package/deps/winpty/src/agent/InputMap.cc +246 -0
- package/deps/winpty/src/agent/InputMap.h +114 -0
- package/deps/winpty/src/agent/LargeConsoleRead.cc +71 -0
- package/deps/winpty/src/agent/LargeConsoleRead.h +68 -0
- package/deps/winpty/src/agent/NamedPipe.cc +378 -0
- package/deps/winpty/src/agent/NamedPipe.h +125 -0
- package/deps/winpty/src/agent/Scraper.cc +699 -0
- package/deps/winpty/src/agent/Scraper.h +103 -0
- package/deps/winpty/src/agent/SimplePool.h +75 -0
- package/deps/winpty/src/agent/SmallRect.h +143 -0
- package/deps/winpty/src/agent/Terminal.cc +535 -0
- package/deps/winpty/src/agent/Terminal.h +69 -0
- package/deps/winpty/src/agent/UnicodeEncoding.h +157 -0
- package/deps/winpty/src/agent/UnicodeEncodingTest.cc +189 -0
- package/deps/winpty/src/agent/Win32Console.cc +107 -0
- package/deps/winpty/src/agent/Win32Console.h +67 -0
- package/deps/winpty/src/agent/Win32ConsoleBuffer.cc +193 -0
- package/deps/winpty/src/agent/Win32ConsoleBuffer.h +99 -0
- package/deps/winpty/src/agent/main.cc +114 -0
- package/deps/winpty/src/agent/subdir.mk +61 -0
- package/deps/winpty/src/configurations.gypi +60 -0
- package/deps/winpty/src/debugserver/DebugServer.cc +117 -0
- package/deps/winpty/src/debugserver/subdir.mk +41 -0
- package/deps/winpty/src/include/winpty.h +242 -0
- package/deps/winpty/src/include/winpty_constants.h +131 -0
- package/deps/winpty/src/libwinpty/AgentLocation.cc +75 -0
- package/deps/winpty/src/libwinpty/AgentLocation.h +28 -0
- package/deps/winpty/src/libwinpty/LibWinptyException.h +54 -0
- package/deps/winpty/src/libwinpty/WinptyInternal.h +72 -0
- package/deps/winpty/src/libwinpty/subdir.mk +46 -0
- package/deps/winpty/src/libwinpty/winpty.cc +970 -0
- package/deps/winpty/src/shared/AgentMsg.h +38 -0
- package/deps/winpty/src/shared/BackgroundDesktop.cc +122 -0
- package/deps/winpty/src/shared/BackgroundDesktop.h +73 -0
- package/deps/winpty/src/shared/Buffer.cc +103 -0
- package/deps/winpty/src/shared/Buffer.h +102 -0
- package/deps/winpty/src/shared/DebugClient.cc +187 -0
- package/deps/winpty/src/shared/DebugClient.h +38 -0
- package/deps/winpty/src/shared/GenRandom.cc +138 -0
- package/deps/winpty/src/shared/GenRandom.h +55 -0
- package/deps/winpty/src/shared/GetCommitHash.bat +13 -0
- package/deps/winpty/src/shared/Mutex.h +54 -0
- package/deps/winpty/src/shared/OsModule.h +63 -0
- package/deps/winpty/src/shared/OwnedHandle.cc +36 -0
- package/deps/winpty/src/shared/OwnedHandle.h +45 -0
- package/deps/winpty/src/shared/PrecompiledHeader.h +43 -0
- package/deps/winpty/src/shared/StringBuilder.h +227 -0
- package/deps/winpty/src/shared/StringBuilderTest.cc +114 -0
- package/deps/winpty/src/shared/StringUtil.cc +55 -0
- package/deps/winpty/src/shared/StringUtil.h +80 -0
- package/deps/winpty/src/shared/TimeMeasurement.h +63 -0
- package/deps/winpty/src/shared/UnixCtrlChars.h +45 -0
- package/deps/winpty/src/shared/UpdateGenVersion.bat +20 -0
- package/deps/winpty/src/shared/WindowsSecurity.cc +460 -0
- package/deps/winpty/src/shared/WindowsSecurity.h +104 -0
- package/deps/winpty/src/shared/WindowsVersion.cc +252 -0
- package/deps/winpty/src/shared/WindowsVersion.h +29 -0
- package/deps/winpty/src/shared/WinptyAssert.cc +55 -0
- package/deps/winpty/src/shared/WinptyAssert.h +64 -0
- package/deps/winpty/src/shared/WinptyException.cc +57 -0
- package/deps/winpty/src/shared/WinptyException.h +43 -0
- package/deps/winpty/src/shared/WinptyVersion.cc +42 -0
- package/deps/winpty/src/shared/WinptyVersion.h +27 -0
- package/deps/winpty/src/shared/winpty_snprintf.h +99 -0
- package/deps/winpty/src/subdir.mk +5 -0
- package/deps/winpty/src/tests/subdir.mk +28 -0
- package/deps/winpty/src/tests/trivial_test.cc +158 -0
- package/deps/winpty/src/unix-adapter/InputHandler.cc +114 -0
- package/deps/winpty/src/unix-adapter/InputHandler.h +56 -0
- package/deps/winpty/src/unix-adapter/OutputHandler.cc +80 -0
- package/deps/winpty/src/unix-adapter/OutputHandler.h +53 -0
- package/deps/winpty/src/unix-adapter/Util.cc +86 -0
- package/deps/winpty/src/unix-adapter/Util.h +31 -0
- package/deps/winpty/src/unix-adapter/WakeupFd.cc +70 -0
- package/deps/winpty/src/unix-adapter/WakeupFd.h +42 -0
- package/deps/winpty/src/unix-adapter/main.cc +729 -0
- package/deps/winpty/src/unix-adapter/subdir.mk +41 -0
- package/deps/winpty/src/winpty.gyp +234 -0
- package/deps/winpty/vcbuild.bat +83 -0
- package/lib/conpty_console_list_agent.js +16 -0
- package/lib/conpty_console_list_agent.js.map +1 -0
- package/lib/eventEmitter2.js +47 -0
- package/lib/eventEmitter2.js.map +1 -0
- package/lib/eventEmitter2.test.js +30 -0
- package/lib/eventEmitter2.test.js.map +1 -0
- package/lib/index.js +52 -0
- package/lib/index.js.map +1 -0
- package/lib/interfaces.js +7 -0
- package/lib/interfaces.js.map +1 -0
- package/lib/shared/conout.js +11 -0
- package/lib/shared/conout.js.map +1 -0
- package/lib/terminal.js +190 -0
- package/lib/terminal.js.map +1 -0
- package/lib/terminal.test.js +139 -0
- package/lib/terminal.test.js.map +1 -0
- package/lib/testUtils.test.js +28 -0
- package/lib/testUtils.test.js.map +1 -0
- package/lib/types.js +7 -0
- package/lib/types.js.map +1 -0
- package/lib/unixTerminal.js +346 -0
- package/lib/unixTerminal.js.map +1 -0
- package/lib/unixTerminal.test.js +351 -0
- package/lib/unixTerminal.test.js.map +1 -0
- package/lib/utils.js +39 -0
- package/lib/utils.js.map +1 -0
- package/lib/windowsConoutConnection.js +125 -0
- package/lib/windowsConoutConnection.js.map +1 -0
- package/lib/windowsPtyAgent.js +320 -0
- package/lib/windowsPtyAgent.js.map +1 -0
- package/lib/windowsPtyAgent.test.js +90 -0
- package/lib/windowsPtyAgent.test.js.map +1 -0
- package/lib/windowsTerminal.js +199 -0
- package/lib/windowsTerminal.js.map +1 -0
- package/lib/windowsTerminal.test.js +219 -0
- package/lib/windowsTerminal.test.js.map +1 -0
- package/lib/worker/conoutSocketWorker.js +22 -0
- package/lib/worker/conoutSocketWorker.js.map +1 -0
- package/package.json +68 -0
- package/prebuilds/darwin-arm64/pty.node +0 -0
- package/prebuilds/darwin-arm64/spawn-helper +0 -0
- package/prebuilds/darwin-x64/pty.node +0 -0
- package/prebuilds/darwin-x64/spawn-helper +0 -0
- package/prebuilds/win32-arm64/conpty/OpenConsole.exe +0 -0
- package/prebuilds/win32-arm64/conpty/conpty.dll +0 -0
- package/prebuilds/win32-arm64/conpty.node +0 -0
- package/prebuilds/win32-arm64/conpty.pdb +0 -0
- package/prebuilds/win32-arm64/conpty_console_list.node +0 -0
- package/prebuilds/win32-arm64/conpty_console_list.pdb +0 -0
- package/prebuilds/win32-arm64/pty.node +0 -0
- package/prebuilds/win32-arm64/pty.pdb +0 -0
- package/prebuilds/win32-arm64/winpty-agent.exe +0 -0
- package/prebuilds/win32-arm64/winpty-agent.pdb +0 -0
- package/prebuilds/win32-arm64/winpty.dll +0 -0
- package/prebuilds/win32-arm64/winpty.pdb +0 -0
- package/prebuilds/win32-x64/conpty/OpenConsole.exe +0 -0
- package/prebuilds/win32-x64/conpty/conpty.dll +0 -0
- package/prebuilds/win32-x64/conpty.node +0 -0
- package/prebuilds/win32-x64/conpty.pdb +0 -0
- package/prebuilds/win32-x64/conpty_console_list.node +0 -0
- package/prebuilds/win32-x64/conpty_console_list.pdb +0 -0
- package/prebuilds/win32-x64/pty.node +0 -0
- package/prebuilds/win32-x64/pty.pdb +0 -0
- package/prebuilds/win32-x64/winpty-agent.exe +0 -0
- package/prebuilds/win32-x64/winpty-agent.pdb +0 -0
- package/prebuilds/win32-x64/winpty.dll +0 -0
- package/prebuilds/win32-x64/winpty.pdb +0 -0
- package/scripts/gen-compile-commands.js +8 -0
- package/scripts/increment-version.js +54 -0
- package/scripts/post-install.js +99 -0
- package/scripts/prebuild.js +39 -0
- package/scripts/sync-prebuild.js +31 -0
- package/scripts/verify-darwin-fd-leak.js +63 -0
- package/src/conpty_console_list_agent.ts +15 -0
- package/src/eventEmitter2.test.ts +30 -0
- package/src/eventEmitter2.ts +48 -0
- package/src/index.ts +52 -0
- package/src/interfaces.ts +130 -0
- package/src/native.d.ts +54 -0
- package/src/shared/conout.ts +15 -0
- package/src/terminal.test.ts +119 -0
- package/src/terminal.ts +211 -0
- package/src/testUtils.test.ts +23 -0
- package/src/tsconfig.json +22 -0
- package/src/types.ts +15 -0
- package/src/unix/pty.cc +808 -0
- package/src/unix/spawn-helper.cc +23 -0
- package/src/unixTerminal.test.ts +367 -0
- package/src/unixTerminal.ts +388 -0
- package/src/utils.ts +29 -0
- package/src/win/conpty.cc +583 -0
- package/src/win/conpty.h +41 -0
- package/src/win/conpty_console_list.cc +44 -0
- package/src/win/path_util.cc +95 -0
- package/src/win/path_util.h +26 -0
- package/src/win/winpty.cc +333 -0
- package/src/windowsConoutConnection.ts +82 -0
- package/src/windowsPtyAgent.test.ts +94 -0
- package/src/windowsPtyAgent.ts +321 -0
- package/src/windowsTerminal.test.ts +229 -0
- package/src/windowsTerminal.ts +203 -0
- package/src/worker/conoutSocketWorker.ts +22 -0
- package/third_party/conpty/1.23.251008001/win10-arm64/OpenConsole.exe +0 -0
- package/third_party/conpty/1.23.251008001/win10-arm64/conpty.dll +0 -0
- package/third_party/conpty/1.23.251008001/win10-x64/OpenConsole.exe +0 -0
- package/third_party/conpty/1.23.251008001/win10-x64/conpty.dll +0 -0
- package/typings/node-pty.d.ts +211 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
Copyright (c) 2012-2015, Christopher Jeffrey (https://github.com/chjj/)
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
5
|
+
in the Software without restriction, including without limitation the rights
|
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
8
|
+
furnished to do so, subject to the following conditions:
|
|
9
|
+
|
|
10
|
+
The above copyright notice and this permission notice shall be included in
|
|
11
|
+
all copies or substantial portions of the Software.
|
|
12
|
+
|
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
19
|
+
THE SOFTWARE.
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
The MIT License (MIT)
|
|
24
|
+
|
|
25
|
+
Copyright (c) 2016, Daniel Imms (http://www.growingwiththeweb.com)
|
|
26
|
+
|
|
27
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
28
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
29
|
+
in the Software without restriction, including without limitation the rights
|
|
30
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
31
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
32
|
+
furnished to do so, subject to the following conditions:
|
|
33
|
+
|
|
34
|
+
The above copyright notice and this permission notice shall be included in all
|
|
35
|
+
copies or substantial portions of the Software.
|
|
36
|
+
|
|
37
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
38
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
39
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
40
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
41
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
42
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
43
|
+
SOFTWARE.
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
MIT License
|
|
48
|
+
|
|
49
|
+
Copyright (c) 2018 - present Microsoft Corporation
|
|
50
|
+
|
|
51
|
+
All rights reserved.
|
|
52
|
+
|
|
53
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
54
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
55
|
+
in the Software without restriction, including without limitation the rights
|
|
56
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
57
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
58
|
+
furnished to do so, subject to the following conditions:
|
|
59
|
+
|
|
60
|
+
The above copyright notice and this permission notice shall be included in all
|
|
61
|
+
copies or substantial portions of the Software.
|
|
62
|
+
|
|
63
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
64
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
65
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
66
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
67
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
68
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
69
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
# @shitiandmw/node-pty
|
|
2
|
+
|
|
3
|
+
This package is an Agent Tower-maintained fork of `microsoft/node-pty` `v1.1.0`.
|
|
4
|
+
It carries a minimal darwin fd leak fix for long-lived PTY workloads and is
|
|
5
|
+
published under `@shitiandmw/node-pty` because the current npm credentials do
|
|
6
|
+
not have publish access to the `@agent-tower` scope.
|
|
7
|
+
|
|
8
|
+
[](https://dev.azure.com/vscode/node-pty/_build/latest?definitionId=11&branchName=main)
|
|
9
|
+
|
|
10
|
+
`forkpty(3)` bindings for node.js. This allows you to fork processes with pseudoterminal file descriptors. It returns a terminal object which allows reads and writes.
|
|
11
|
+
|
|
12
|
+
This is useful for:
|
|
13
|
+
|
|
14
|
+
- Writing a terminal emulator (eg. via [xterm.js](https://github.com/sourcelair/xterm.js)).
|
|
15
|
+
- Getting certain programs to *think* you're a terminal, such as when you need a program to send you control sequences.
|
|
16
|
+
|
|
17
|
+
`node-pty` supports Linux, macOS and Windows. Windows support is possible by utilizing the [Windows conpty API](https://blogs.msdn.microsoft.com/commandline/2018/08/02/windows-command-line-introducing-the-windows-pseudo-console-conpty/) on Windows 1809+ and the [winpty](https://github.com/rprichard/winpty) library in older version.
|
|
18
|
+
|
|
19
|
+
## API
|
|
20
|
+
|
|
21
|
+
The full API for node-pty is contained within the [TypeScript declaration file](https://github.com/microsoft/node-pty/blob/main/typings/node-pty.d.ts), use the branch/tag picker in GitHub (`w`) to navigate to the correct version of the API.
|
|
22
|
+
|
|
23
|
+
## Example Usage
|
|
24
|
+
|
|
25
|
+
```js
|
|
26
|
+
import * as os from 'node:os';
|
|
27
|
+
import * as pty from 'node-pty';
|
|
28
|
+
|
|
29
|
+
const shell = os.platform() === 'win32' ? 'powershell.exe' : 'bash';
|
|
30
|
+
|
|
31
|
+
const ptyProcess = pty.spawn(shell, [], {
|
|
32
|
+
name: 'xterm-color',
|
|
33
|
+
cols: 80,
|
|
34
|
+
rows: 30,
|
|
35
|
+
cwd: process.env.HOME,
|
|
36
|
+
env: process.env
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
ptyProcess.onData((data) => {
|
|
40
|
+
process.stdout.write(data);
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
ptyProcess.write('ls\r');
|
|
44
|
+
ptyProcess.resize(100, 40);
|
|
45
|
+
ptyProcess.write('ls\r');
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Real-world Uses
|
|
49
|
+
|
|
50
|
+
`node-pty` powers many different terminal emulators, including:
|
|
51
|
+
|
|
52
|
+
- [Microsoft Visual Studio Code](https://code.visualstudio.com)
|
|
53
|
+
- [Hyper](https://hyper.is/)
|
|
54
|
+
- [Upterm](https://github.com/railsware/upterm)
|
|
55
|
+
- [Script Runner](https://github.com/ioquatix/script-runner) for Atom.
|
|
56
|
+
- [Theia](https://github.com/theia-ide/theia)
|
|
57
|
+
- [FreeMAN](https://github.com/matthew-matvei/freeman) file manager
|
|
58
|
+
- [terminus](https://atom.io/packages/terminus) - An Atom plugin for providing terminals inside your Atom workspace.
|
|
59
|
+
- [x-terminal](https://atom.io/packages/x-terminal) - Also an Atom plugin that provides terminals inside your Atom workspace.
|
|
60
|
+
- [Termination](https://atom.io/packages/termination) - Also an Atom plugin that provides terminals inside your Atom workspace.
|
|
61
|
+
- [atom-xterm](https://atom.io/packages/atom-xterm) - Also an Atom plugin that provides terminals inside your Atom workspace.
|
|
62
|
+
- [electerm](https://github.com/electerm/electerm) Terminal/SSH/SFTP client(Linux, macOS, Windows).
|
|
63
|
+
- [Extraterm](http://extraterm.org/)
|
|
64
|
+
- [Wetty](https://github.com/krishnasrinivas/wetty) Browser based Terminal over HTTP and HTTPS
|
|
65
|
+
- [nomad](https://github.com/lukebarnard1/nomad-term)
|
|
66
|
+
- [DockerStacks](https://github.com/sfx101/docker-stacks) Local LAMP/LEMP stack using Docker
|
|
67
|
+
- [TeleType](https://github.com/akshaykmr/TeleType): cli tool that allows you to share your terminal online conveniently. Show off mad cli-fu, help a colleague, teach, or troubleshoot.
|
|
68
|
+
- [mesos-term](https://github.com/criteo/mesos-term): A web terminal for Apache Mesos. It allows to execute commands within containers.
|
|
69
|
+
- [Commas](https://github.com/CyanSalt/commas): A hackable terminal and command runner.
|
|
70
|
+
- [ENiGMA½ BBS Software](https://github.com/NuSkooler/enigma-bbs): A modern BBS software with a nostalgic flair!
|
|
71
|
+
- [Tinkerun](https://github.com/tinkerun/tinkerun): A new way of running Tinker.
|
|
72
|
+
- [Tess](https://tessapp.dev): Hackable, simple and rapid terminal for the new era of technology 👍
|
|
73
|
+
- [NxShell](https://nxshell.github.io/): An easy to use new terminal for Windows/Linux/MacOS platform.
|
|
74
|
+
- [OpenSumi](https://github.com/opensumi/core): A framework helps you quickly build Cloud or Desktop IDE products.
|
|
75
|
+
- [Enjoy Git](https://github.com/huangcs427/enjoy-git-release): A modern Git client featuring an intuitive user interface, built with Electron, Vue 3, and TypeScript.
|
|
76
|
+
|
|
77
|
+
Do you use node-pty in your application as well? Please open a [Pull Request](https://github.com/Tyriar/node-pty/pulls) to include it here. We would love to have it in our list.
|
|
78
|
+
|
|
79
|
+
## Building
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
# Install dependencies and build C++
|
|
83
|
+
npm install
|
|
84
|
+
# Compile TypeScript -> JavaScript
|
|
85
|
+
npm run build
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Dependencies
|
|
89
|
+
|
|
90
|
+
Node.JS 16 or Electron 19 is required to use `node-pty`. What version of node is supported is currently mostly bound to [whatever version Visual Studio Code is using](https://github.com/microsoft/node-pty/issues/557#issuecomment-1332193541).
|
|
91
|
+
|
|
92
|
+
### Linux (apt)
|
|
93
|
+
|
|
94
|
+
```sh
|
|
95
|
+
sudo apt install -y make python build-essential
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### macOS
|
|
99
|
+
|
|
100
|
+
Xcode is needed to compile the sources, this can be installed from the App Store.
|
|
101
|
+
|
|
102
|
+
### Windows
|
|
103
|
+
|
|
104
|
+
`npm install` requires some tools to be present in the system like Python and C++ compiler. Windows users can easily install them by running the following command in PowerShell as administrator. For more information see https://github.com/felixrieseberg/windows-build-tools:
|
|
105
|
+
|
|
106
|
+
```sh
|
|
107
|
+
npm install --global --production windows-build-tools
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
The following are also needed:
|
|
111
|
+
|
|
112
|
+
- [Windows SDK](https://developer.microsoft.com/en-us/windows/downloads/windows-10-sdk) - only the "Desktop C++ Apps" components are needed to be installed
|
|
113
|
+
- Spectre-mitigated libraries - In order to avoid the build error "MSB8040: Spectre-mitigated libraries are required for this project", open the Visual Studio Installer, press the Modify button, navigate to the "Individual components" tab, search "Spectre", and install an option like "MSVC v143 - VS 2022 C++ x64/x86 Spectre-mitigated libs (Latest)" (the exact option to install will depend on your version of Visual Studio as well as your operating system architecture)
|
|
114
|
+
|
|
115
|
+
## Debugging
|
|
116
|
+
|
|
117
|
+
[The wiki](https://github.com/Microsoft/node-pty/wiki/Debugging) contains instructions for debugging node-pty.
|
|
118
|
+
|
|
119
|
+
## Security
|
|
120
|
+
|
|
121
|
+
All processes launched from node-pty will launch at the same permission level of the parent process. Take care particularly when using node-pty inside a server that's accessible on the internet. We recommend launching the pty inside a container to protect your host machine.
|
|
122
|
+
|
|
123
|
+
## Thread Safety
|
|
124
|
+
|
|
125
|
+
Note that node-pty is not thread safe so running it across multiple worker threads in node.js could cause issues.
|
|
126
|
+
|
|
127
|
+
## Flow Control
|
|
128
|
+
|
|
129
|
+
Automatic flow control can be enabled by either providing `handleFlowControl = true` in the constructor options or setting it later on:
|
|
130
|
+
|
|
131
|
+
```js
|
|
132
|
+
const PAUSE = '\x13'; // XOFF
|
|
133
|
+
const RESUME = '\x11'; // XON
|
|
134
|
+
|
|
135
|
+
const ptyProcess = pty.spawn(shell, [], {handleFlowControl: true});
|
|
136
|
+
|
|
137
|
+
// flow control in action
|
|
138
|
+
ptyProcess.write(PAUSE); // pty will block and pause the child program
|
|
139
|
+
...
|
|
140
|
+
ptyProcess.write(RESUME); // pty will enter flow mode and resume the child program
|
|
141
|
+
|
|
142
|
+
// temporarily disable/re-enable flow control
|
|
143
|
+
ptyProcess.handleFlowControl = false;
|
|
144
|
+
...
|
|
145
|
+
ptyProcess.handleFlowControl = true;
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
By default `PAUSE` and `RESUME` are XON/XOFF control codes (as shown above). To avoid conflicts in environments that use these control codes for different purposes the messages can be customized as `flowControlPause: string` and `flowControlResume: string` in the constructor options. `PAUSE` and `RESUME` are not passed to the underlying pseudoterminal if flow control is enabled.
|
|
149
|
+
|
|
150
|
+
## Troubleshooting
|
|
151
|
+
|
|
152
|
+
### Powershell gives error 8009001d
|
|
153
|
+
|
|
154
|
+
> Internal Windows PowerShell error. Loading managed Windows PowerShell failed with error 8009001d.
|
|
155
|
+
|
|
156
|
+
This happens when PowerShell is launched with no `SystemRoot` environment variable present.
|
|
157
|
+
|
|
158
|
+
### ConnectNamedPipe failed: Windows error 232
|
|
159
|
+
|
|
160
|
+
This error can occur due to anti-virus software intercepting winpty from creating a pty. To workaround this you can exclude this file from your anti-virus scanning `node-pty\build\Release\winpty-agent.exe`
|
|
161
|
+
|
|
162
|
+
## pty.js
|
|
163
|
+
|
|
164
|
+
This project is forked from [chjj/pty.js](https://github.com/chjj/pty.js) with the primary goals being to provide better support for later Node.js versions and Windows.
|
|
165
|
+
|
|
166
|
+
## License
|
|
167
|
+
|
|
168
|
+
Copyright (c) 2012-2015, Christopher Jeffrey (MIT License).<br>
|
|
169
|
+
Copyright (c) 2016, Daniel Imms (MIT License).<br>
|
|
170
|
+
Copyright (c) 2018, Microsoft Corporation (MIT License).
|
package/binding.gyp
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
{
|
|
2
|
+
'target_defaults': {
|
|
3
|
+
'dependencies': [
|
|
4
|
+
"<!(node -p \"require('node-addon-api').targets\"):node_addon_api_except",
|
|
5
|
+
],
|
|
6
|
+
'conditions': [
|
|
7
|
+
['OS=="win"', {
|
|
8
|
+
'msvs_configuration_attributes': {
|
|
9
|
+
'SpectreMitigation': 'Spectre'
|
|
10
|
+
},
|
|
11
|
+
'msvs_settings': {
|
|
12
|
+
'VCCLCompilerTool': {
|
|
13
|
+
'AdditionalOptions': [
|
|
14
|
+
'/guard:cf',
|
|
15
|
+
'/sdl',
|
|
16
|
+
'/W3',
|
|
17
|
+
'/w34244',
|
|
18
|
+
'/w34267',
|
|
19
|
+
'/ZH:SHA_256'
|
|
20
|
+
]
|
|
21
|
+
},
|
|
22
|
+
'VCLinkerTool': {
|
|
23
|
+
'AdditionalOptions': [
|
|
24
|
+
'/DYNAMICBASE',
|
|
25
|
+
'/guard:cf'
|
|
26
|
+
]
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
}],
|
|
30
|
+
],
|
|
31
|
+
},
|
|
32
|
+
'conditions': [
|
|
33
|
+
['OS=="win"', {
|
|
34
|
+
'targets': [
|
|
35
|
+
{
|
|
36
|
+
'target_name': 'conpty',
|
|
37
|
+
'sources' : [
|
|
38
|
+
'src/win/conpty.cc',
|
|
39
|
+
'src/win/path_util.cc'
|
|
40
|
+
],
|
|
41
|
+
'libraries': [
|
|
42
|
+
'-lshlwapi'
|
|
43
|
+
],
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
'target_name': 'conpty_console_list',
|
|
47
|
+
'sources' : [
|
|
48
|
+
'src/win/conpty_console_list.cc'
|
|
49
|
+
],
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
'target_name': 'pty',
|
|
53
|
+
'include_dirs' : [
|
|
54
|
+
'<!(node -p "require(\'node-addon-api\').include_dir")',
|
|
55
|
+
'deps/winpty/src/include',
|
|
56
|
+
],
|
|
57
|
+
# Disabled due to winpty
|
|
58
|
+
'msvs_disabled_warnings': [ 4506, 4530 ],
|
|
59
|
+
'dependencies' : [
|
|
60
|
+
'deps/winpty/src/winpty.gyp:winpty-agent',
|
|
61
|
+
'deps/winpty/src/winpty.gyp:winpty',
|
|
62
|
+
],
|
|
63
|
+
'sources' : [
|
|
64
|
+
'src/win/winpty.cc',
|
|
65
|
+
'src/win/path_util.cc'
|
|
66
|
+
],
|
|
67
|
+
'libraries': [
|
|
68
|
+
'-lshlwapi'
|
|
69
|
+
],
|
|
70
|
+
}
|
|
71
|
+
]
|
|
72
|
+
}, { # OS!="win"
|
|
73
|
+
'targets': [
|
|
74
|
+
{
|
|
75
|
+
'target_name': 'pty',
|
|
76
|
+
'sources': [
|
|
77
|
+
'src/unix/pty.cc',
|
|
78
|
+
],
|
|
79
|
+
'libraries': [
|
|
80
|
+
'-lutil'
|
|
81
|
+
],
|
|
82
|
+
'cflags': ['-Wall', '-O2', '-D_FORTIFY_SOURCE=2'],
|
|
83
|
+
'conditions': [
|
|
84
|
+
# http://www.gnu.org/software/gnulib/manual/html_node/forkpty.html
|
|
85
|
+
# One some systems (at least including Cygwin, Interix,
|
|
86
|
+
# OSF/1 4 and 5, and Mac OS X) linking with -lutil is not required.
|
|
87
|
+
['OS=="mac" or OS=="solaris"', {
|
|
88
|
+
'libraries!': [
|
|
89
|
+
'-lutil'
|
|
90
|
+
]
|
|
91
|
+
}]
|
|
92
|
+
]
|
|
93
|
+
}
|
|
94
|
+
]
|
|
95
|
+
}],
|
|
96
|
+
['OS=="mac"', {
|
|
97
|
+
'targets': [
|
|
98
|
+
{
|
|
99
|
+
'target_name': 'spawn-helper',
|
|
100
|
+
'type': 'executable',
|
|
101
|
+
'sources': [
|
|
102
|
+
'src/unix/spawn-helper.cc',
|
|
103
|
+
],
|
|
104
|
+
"xcode_settings": {
|
|
105
|
+
"MACOSX_DEPLOYMENT_TARGET":"10.7"
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
]
|
|
109
|
+
}]
|
|
110
|
+
]
|
|
111
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Build configure for https://www.tea-ci.org (fork of Drone CI with Msys2 support)
|
|
2
|
+
build:
|
|
3
|
+
image: teaci/msys$$arch
|
|
4
|
+
pull: true
|
|
5
|
+
shell: msys$$arch
|
|
6
|
+
commands:
|
|
7
|
+
- pacman -S --needed --noconfirm --noprogressbar mingw-w64-cross-gcc mingw-w64-cross-crt-git
|
|
8
|
+
- ./configure
|
|
9
|
+
- make
|
|
10
|
+
- make tests
|
|
11
|
+
- build/trivial_test.exe
|
|
12
|
+
- mintty --log - --exec build/winpty.exe cmd /c ver | grep Windows
|
|
13
|
+
|
|
14
|
+
matrix:
|
|
15
|
+
arch:
|
|
16
|
+
- 64
|
|
17
|
+
- 32
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
* text=auto
|
|
2
|
+
*.bat text eol=crlf
|
|
3
|
+
*.c text
|
|
4
|
+
*.cc text
|
|
5
|
+
*.gyp text
|
|
6
|
+
*.gypi text
|
|
7
|
+
*.h text
|
|
8
|
+
*.ps1 text eol=crlf
|
|
9
|
+
*.rst text
|
|
10
|
+
*.sh text
|
|
11
|
+
*.txt text
|
|
12
|
+
.gitignore text
|
|
13
|
+
.gitattributes text
|
|
14
|
+
Makefile text
|
|
15
|
+
configure text
|
|
16
|
+
|
|
17
|
+
*.sh eol=lf
|
|
18
|
+
configure eol=lf
|
|
19
|
+
VERSION.txt eol=lf
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2011-2016 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.
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
# Copyright (c) 2011-2015 Ryan Prichard
|
|
2
|
+
#
|
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
+
# of this software and associated documentation files (the "Software"), to
|
|
5
|
+
# deal in the Software without restriction, including without limitation the
|
|
6
|
+
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
|
7
|
+
# sell copies of the Software, and to permit persons to whom the Software is
|
|
8
|
+
# furnished to do so, subject to the following conditions:
|
|
9
|
+
#
|
|
10
|
+
# The above copyright notice and this permission notice shall be included in
|
|
11
|
+
# all copies or substantial portions of the Software.
|
|
12
|
+
#
|
|
13
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
18
|
+
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
|
19
|
+
# IN THE SOFTWARE.
|
|
20
|
+
|
|
21
|
+
# Use make -n to see the actual command-lines make would run.
|
|
22
|
+
|
|
23
|
+
# The default "make install" prefix is /usr/local. Pass PREFIX=<path> on the
|
|
24
|
+
# command-line to override the default.
|
|
25
|
+
|
|
26
|
+
.SECONDEXPANSION :
|
|
27
|
+
|
|
28
|
+
.PHONY : default
|
|
29
|
+
default : all
|
|
30
|
+
|
|
31
|
+
PREFIX := /usr/local
|
|
32
|
+
UNIX_ADAPTER_EXE := winpty.exe
|
|
33
|
+
MINGW_ENABLE_CXX11_FLAG := -std=c++11
|
|
34
|
+
USE_PCH := 1
|
|
35
|
+
|
|
36
|
+
COMMON_CXXFLAGS :=
|
|
37
|
+
UNIX_CXXFLAGS :=
|
|
38
|
+
MINGW_CXXFLAGS :=
|
|
39
|
+
MINGW_LDFLAGS :=
|
|
40
|
+
UNIX_LDFLAGS :=
|
|
41
|
+
|
|
42
|
+
# Include config.mk but complain if it hasn't been created yet.
|
|
43
|
+
ifeq "$(wildcard config.mk)" ""
|
|
44
|
+
$(error config.mk does not exist. Please run ./configure)
|
|
45
|
+
endif
|
|
46
|
+
include config.mk
|
|
47
|
+
|
|
48
|
+
COMMON_CXXFLAGS += \
|
|
49
|
+
-MMD -Wall \
|
|
50
|
+
-DUNICODE \
|
|
51
|
+
-D_UNICODE \
|
|
52
|
+
-D_WIN32_WINNT=0x0501 \
|
|
53
|
+
-Ibuild/gen
|
|
54
|
+
|
|
55
|
+
UNIX_CXXFLAGS += \
|
|
56
|
+
$(COMMON_CXXFLAGS)
|
|
57
|
+
|
|
58
|
+
MINGW_CXXFLAGS += \
|
|
59
|
+
$(COMMON_CXXFLAGS) \
|
|
60
|
+
-O2 \
|
|
61
|
+
$(MINGW_ENABLE_CXX11_FLAG)
|
|
62
|
+
|
|
63
|
+
MINGW_LDFLAGS += -static -static-libgcc -static-libstdc++
|
|
64
|
+
UNIX_LDFLAGS += $(UNIX_LDFLAGS_STATIC)
|
|
65
|
+
|
|
66
|
+
ifeq "$(USE_PCH)" "1"
|
|
67
|
+
MINGW_CXXFLAGS += -include build/mingw/PrecompiledHeader.h
|
|
68
|
+
PCH_DEP := build/mingw/PrecompiledHeader.h.gch
|
|
69
|
+
else
|
|
70
|
+
PCH_DEP :=
|
|
71
|
+
endif
|
|
72
|
+
|
|
73
|
+
build/gen/GenVersion.h : VERSION.txt $(COMMIT_HASH_DEP) | $$(@D)/.mkdir
|
|
74
|
+
$(info Updating build/gen/GenVersion.h)
|
|
75
|
+
@echo "const char GenVersion_Version[] = \"$(shell cat VERSION.txt | tr -d '\r\n')\";" > build/gen/GenVersion.h
|
|
76
|
+
@echo "const char GenVersion_Commit[] = \"$(COMMIT_HASH)\";" >> build/gen/GenVersion.h
|
|
77
|
+
|
|
78
|
+
build/mingw/PrecompiledHeader.h : src/shared/PrecompiledHeader.h | $$(@D)/.mkdir
|
|
79
|
+
$(info Copying $< to $@)
|
|
80
|
+
@cp $< $@
|
|
81
|
+
|
|
82
|
+
build/mingw/PrecompiledHeader.h.gch : build/mingw/PrecompiledHeader.h | $$(@D)/.mkdir
|
|
83
|
+
$(info Compiling $<)
|
|
84
|
+
@$(MINGW_CXX) $(MINGW_CXXFLAGS) -c -o $@ $<
|
|
85
|
+
|
|
86
|
+
-include build/mingw/PrecompiledHeader.h.d
|
|
87
|
+
|
|
88
|
+
define def_unix_target
|
|
89
|
+
build/$1/%.o : src/%.cc | $$$$(@D)/.mkdir
|
|
90
|
+
$$(info Compiling $$<)
|
|
91
|
+
@$$(UNIX_CXX) $$(UNIX_CXXFLAGS) $2 -I src/include -c -o $$@ $$<
|
|
92
|
+
endef
|
|
93
|
+
|
|
94
|
+
define def_mingw_target
|
|
95
|
+
build/$1/%.o : src/%.cc $$(PCH_DEP) | $$$$(@D)/.mkdir
|
|
96
|
+
$$(info Compiling $$<)
|
|
97
|
+
@$$(MINGW_CXX) $$(MINGW_CXXFLAGS) $2 -I src/include -c -o $$@ $$<
|
|
98
|
+
endef
|
|
99
|
+
|
|
100
|
+
include src/subdir.mk
|
|
101
|
+
|
|
102
|
+
.PHONY : all
|
|
103
|
+
all : $(ALL_TARGETS)
|
|
104
|
+
|
|
105
|
+
.PHONY : tests
|
|
106
|
+
tests : $(TEST_PROGRAMS)
|
|
107
|
+
|
|
108
|
+
.PHONY : install-bin
|
|
109
|
+
install-bin : all
|
|
110
|
+
mkdir -p $(PREFIX)/bin
|
|
111
|
+
install -m 755 -p -s build/$(UNIX_ADAPTER_EXE) $(PREFIX)/bin
|
|
112
|
+
install -m 755 -p -s build/winpty.dll $(PREFIX)/bin
|
|
113
|
+
install -m 755 -p -s build/winpty-agent.exe $(PREFIX)/bin
|
|
114
|
+
|
|
115
|
+
.PHONY : install-debugserver
|
|
116
|
+
install-debugserver : all
|
|
117
|
+
mkdir -p $(PREFIX)/bin
|
|
118
|
+
install -m 755 -p -s build/winpty-debugserver.exe $(PREFIX)/bin
|
|
119
|
+
|
|
120
|
+
.PHONY : install-lib
|
|
121
|
+
install-lib : all
|
|
122
|
+
mkdir -p $(PREFIX)/lib
|
|
123
|
+
install -m 644 -p build/winpty.lib $(PREFIX)/lib
|
|
124
|
+
|
|
125
|
+
.PHONY : install-doc
|
|
126
|
+
install-doc :
|
|
127
|
+
mkdir -p $(PREFIX)/share/doc/winpty
|
|
128
|
+
install -m 644 -p LICENSE $(PREFIX)/share/doc/winpty
|
|
129
|
+
install -m 644 -p README.md $(PREFIX)/share/doc/winpty
|
|
130
|
+
install -m 644 -p RELEASES.md $(PREFIX)/share/doc/winpty
|
|
131
|
+
|
|
132
|
+
.PHONY : install-include
|
|
133
|
+
install-include :
|
|
134
|
+
mkdir -p $(PREFIX)/include/winpty
|
|
135
|
+
install -m 644 -p src/include/winpty.h $(PREFIX)/include/winpty
|
|
136
|
+
install -m 644 -p src/include/winpty_constants.h $(PREFIX)/include/winpty
|
|
137
|
+
|
|
138
|
+
.PHONY : install
|
|
139
|
+
install : \
|
|
140
|
+
install-bin \
|
|
141
|
+
install-debugserver \
|
|
142
|
+
install-lib \
|
|
143
|
+
install-doc \
|
|
144
|
+
install-include
|
|
145
|
+
|
|
146
|
+
.PHONY : clean
|
|
147
|
+
clean :
|
|
148
|
+
rm -fr build
|
|
149
|
+
|
|
150
|
+
.PHONY : clean-msvc
|
|
151
|
+
clean-msvc :
|
|
152
|
+
rm -fr src/Default src/Release src/.vs src/gen
|
|
153
|
+
rm -f src/*.vcxproj src/*.vcxproj.filters src/*.sln src/*.sdf
|
|
154
|
+
|
|
155
|
+
.PHONY : distclean
|
|
156
|
+
distclean : clean
|
|
157
|
+
rm -f config.mk
|
|
158
|
+
|
|
159
|
+
.PRECIOUS : %.mkdir
|
|
160
|
+
%.mkdir :
|
|
161
|
+
$(info Creating directory $(dir $@))
|
|
162
|
+
@mkdir -p $(dir $@)
|
|
163
|
+
@touch $@
|
|
164
|
+
|
|
165
|
+
src/%.h :
|
|
166
|
+
@echo "Missing header file $@ (stale dependency file?)"
|