Add new PTY node (replaces Pseudoterminal node)

Uses fork of node-pty native code for forking pseudoterminals.
Uses libuv pipe handle to communicate with the child process.

- Paves the way for cross-platform (Linux, macOS and Windows) support.
- Renames Pseudoterminal to PTY (which is much easier to type and spell :D).
- Better performance than the old Pseudoterminal node. Especially when
  streaming large amounts of data such as running the `yes` command.
- Allows setting custom file, args, initial window size, cwd, env vars
  (including important ones such as TERM and COLORTERM) and uid/gid
  on Linux and macOS.
- Returns process exit code and terminating signal.
This commit is contained in:
Leroy Hopson 2021-07-03 00:27:34 +07:00 committed by Leroy Hopson
parent bfa561357e
commit 0dd2378387
36 changed files with 1268 additions and 442 deletions

View file

@ -218,10 +218,13 @@ env.Append(CXXFLAGS=['-std=c++14'])
env.Append(CPPPATH=[
'src/',
'thirdparty/libtsm/build/src/tsm',
'thirdparty/libtsm/build/src/shared',
'thirdparty/godot-cpp/include/',
'thirdparty/godot-cpp/include/core/',
'thirdparty/godot-cpp/include/gen/',
'thirdparty/godot-cpp/godot-headers/'
'thirdparty/godot-cpp/godot-headers/',
'thirdparty/libuv/src',
'thirdparty/libuv/include'
])
env.Append(LIBPATH=[
'thirdparty/godot-cpp/bin/',
@ -247,10 +250,12 @@ sources = []
sources.append('src/libgodotxtermnative.cpp')
sources.append('src/terminal.cpp')
# Psuedoterminal not supported on windows (yet) or HTML5.
if env['platform'] != 'windows' and env['platform'] != 'javascript':
sources.append('src/pseudoterminal.cpp')
env.Append(LIBS=['util'])
# PTY not supported on HTML5 or Windows (yet).
if env['platform'] != 'javascript' and env['platform'] != 'windows':
sources.append('src/pipe.cpp')
sources.append('src/libuv_utils.cpp')
sources.append('src/node_pty/unix/pty.cc')
env.Append(LIBS=['util', env.File('thirdparty/libuv/build/libuv_a.a')])
if env['platform'] == 'linux':
libsuffix = "a"