mirror of
https://github.com/lihop/godot-xterm.git
synced 2024-09-20 16:36:19 +02:00
0dd2378387
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.
43 lines
No EOL
1.1 KiB
C++
43 lines
No EOL
1.1 KiB
C++
#ifndef GODOT_XTERM_UV_UTILS_H
|
|
#define GODOT_XTERM_UV_UTILS_H
|
|
|
|
#include <Godot.hpp>
|
|
#include <uv.h>
|
|
|
|
#define UV_ERR_PRINT(uv_err) \
|
|
ERR_PRINT(String(uv_err_name(uv_err)) + String(": ") + \
|
|
String(uv_strerror(uv_err)));
|
|
|
|
#define RETURN_UV_ERR(uv_err) \
|
|
UV_ERR_PRINT(uv_err); \
|
|
return LibuvUtils::translate_uv_errno(uv_err);
|
|
|
|
#define RETURN_IF_UV_ERR(uv_err) \
|
|
if (uv_err < 0) { \
|
|
RETURN_UV_ERR(uv_err); \
|
|
}
|
|
|
|
namespace godot {
|
|
|
|
class LibuvUtils : public Reference {
|
|
GODOT_CLASS(LibuvUtils, Reference)
|
|
|
|
public:
|
|
static void _register_methods();
|
|
|
|
LibuvUtils();
|
|
~LibuvUtils();
|
|
|
|
void _init();
|
|
|
|
Dictionary get_os_environ();
|
|
String get_os_release();
|
|
String get_cwd();
|
|
|
|
public:
|
|
static godot_error translate_uv_errno(int uv_err);
|
|
};
|
|
|
|
} // namespace godot
|
|
|
|
#endif // GODOT_XTERM_UV_UTILS_H
|