mirror of
https://github.com/lihop/godot-xterm.git
synced 2025-05-05 12:44:24 +02:00
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:
parent
bfa561357e
commit
0dd2378387
36 changed files with 1268 additions and 442 deletions
31
addons/godot_xterm/native/src/node_pty/unix/pty.h
Normal file
31
addons/godot_xterm/native/src/node_pty/unix/pty.h
Normal file
|
@ -0,0 +1,31 @@
|
|||
// Copyright (c) 2021, Leroy Hopson (MIT License).
|
||||
|
||||
#ifndef GODOT_XTERM_PTY_H
|
||||
#define GODOT_XTERM_PTY_H
|
||||
|
||||
#include <FuncRef.hpp>
|
||||
#include <Godot.hpp>
|
||||
|
||||
namespace godot {
|
||||
|
||||
class PTYUnix : public Reference {
|
||||
GODOT_CLASS(PTYUnix, Reference)
|
||||
|
||||
public:
|
||||
Array fork(String file,
|
||||
int _ignored, /* FIXME: For some reason Pipe throws
|
||||
ENOTSOCK in read callback if args (or another non-empty,
|
||||
non-zero) value is in this position. */
|
||||
PoolStringArray args, PoolStringArray env, String cwd, int cols,
|
||||
int rows, int uid, int gid, bool utf8, Ref<FuncRef> on_exit);
|
||||
Array open(int cols, int rows);
|
||||
godot_error resize(int fd, int cols, int rows);
|
||||
String process(int fd, String tty);
|
||||
|
||||
void _init();
|
||||
static void _register_methods();
|
||||
};
|
||||
|
||||
} // namespace godot
|
||||
|
||||
#endif // GODOT_XTERM_PTY_H
|
Loading…
Add table
Add a link
Reference in a new issue