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

@ -15,21 +15,32 @@ fi
# Update git submodules.
LIBTSM_DIR=${NATIVE_DIR}/thirdparty/libtsm
if [ -z "$(ls -A -- "$LIBTSM_DIR")" ]; then
cd ${NATIVE_DIR}
git submodule update --init --recursive -- $LIBTSM_DIR
fi
GODOT_CPP_DIR=${NATIVE_DIR}/thirdparty/godot-cpp
if [ -z "$(ls -A -- "$GODOT_CPP_DIR")" ]; then
cd ${NATIVE_DIR}
git submodule update --init --recursive -- $GODOT_CPP_DIR
fi
updateSubmodules() {
eval $1=$2 # E.g LIBUV_DIR=${NATIVE_DIR}/thirdparty/libuv
if [ -z "$(ls -A -- "$2")" ]; then
cd ${NATIVE_DIR}
git submodule update --init --recursive -- $2
fi
}
updateSubmodules LIBUV_DIR ${NATIVE_DIR}/thirdparty/libuv
updateSubmodules LIBTSM_DIR ${NATIVE_DIR}/thirdparty/libtsm
updateSubmodules GODOT_CPP_DIR ${NATIVE_DIR}/thirdparty/godot-cpp
# Build godot-cpp bindings.
cd ${GODOT_CPP_DIR}
scons generate_bindings=yes target=debug -j$(nproc)
# Build libuv as a static library.
cd ${LIBUV_DIR}
mkdir build || true
cd build
cmake .. -DCMAKE_BUILD_TYPE=debug -DBUILD_SHARED_LIBS=OFF -DCMAKE_POSITION_INDEPENDENT_CODE=TRUE
cd ..
cmake --build build -j$(nproc)
# Build libgodot-xterm.
cd ${NATIVE_DIR}
scons target=debug -j$(nproc)