Closed rowheel closed 1 year ago
We are not testing the module actively on FreeBSD, happy to accept the change if this addresses the issue referenced. Can you undo the changes not required for FreeBSD
Sure. Please refer to the latest commit.
PS: After applying this patch, node-pty does indeed compile on FreeBSD:
console@qemu-kvm:~/src/rowheel/node-pty $ uname -a
FreeBSD qemu-kvm 13.2-RELEASE FreeBSD 13.2-RELEASE releng/13.2-n254617-525ecfdad597 GENERIC amd64
console@qemu-kvm:~/src/rowheel/node-pty $ less src/unix/pty.cc
/**
* Copyright (c) 2012-2015, Christopher Jeffrey (MIT License)
* Copyright (c) 2017, Daniel Imms (MIT License)
*
* pty.cc:
* This file is responsible for starting processes
* with pseudo-terminal file descriptors.
*
* See:
* man pty
* man tty_ioctl
* man termios
* man forkpty
*/
/**
* Includes
*/
#include <nan.h>
#include <errno.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <sys/wait.h>
#include <fcntl.h>
#include <signal.h>
/* forkpty */
/* http://www.gnu.org/software/gnulib/manual/html_node/forkpty.html */
#if defined(__linux__)
#include <pty.h>
#elif defined(__APPLE__)
#include <util.h>
#elif defined(__FreeBSD__)
#include <libutil.h>
#endif
/* Some platforms name VWERASE and VDISCARD differently */
#if !defined(VWERASE) && defined(VWERSE)
#define VWERASE VWERSE
#endif
#if !defined(VDISCARD) && defined(VDISCRD)
#define VDISCARD VDISCRD
#endif
/* for pty_getproc */
#if defined(__linux__)
#include <stdio.h>
console@qemu-kvm:~/src/rowheel/node-pty $ yarn
yarn install v1.22.19
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
$ node-gyp rebuild
[###################################################################################################################################################################################] 391/391gyp info it worked if it ends with ok
gyp info using node-gyp@9.3.1
gyp info using node@16.20.0 | freebsd | x64
gyp info find Python using Python version 3.9.16 found at "/usr/local/bin/python3.9"
gyp info spawn /usr/local/bin/python3.9
gyp info spawn args [
gyp info spawn args '/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args 'binding.gyp',
gyp info spawn args '-f',
gyp info spawn args 'make',
gyp info spawn args '-I',
gyp info spawn args '/usr/home/console/src/rowheel/node-pty/build/config.gypi',
gyp info spawn args '-I',
gyp info spawn args '/usr/local/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
gyp info spawn args '-I',
gyp info spawn args '/home/console/.cache/node-gyp/16.20.0/include/node/common.gypi',
gyp info spawn args '-Dlibrary=shared_library',
gyp info spawn args '-Dvisibility=default',
gyp info spawn args '-Dnode_root_dir=/home/console/.cache/node-gyp/16.20.0',
gyp info spawn args '-Dnode_gyp_dir=/usr/local/lib/node_modules/npm/node_modules/node-gyp',
gyp info spawn args '-Dnode_lib_file=/home/console/.cache/node-gyp/16.20.0/<(target_arch)/node.lib',
gyp info spawn args '-Dmodule_root_dir=/usr/home/console/src/rowheel/node-pty',
gyp info spawn args '-Dnode_engine=v8',
gyp info spawn args '--depth=.',
gyp info spawn args '--no-parallel',
gyp info spawn args '--generator-output',
gyp info spawn args 'build',
gyp info spawn args '-Goutput_dir=.'
gyp info spawn args ]
gyp info spawn gmake
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
gmake: Entering directory '/usr/home/console/src/rowheel/node-pty/build'
CXX(target) Release/obj.target/pty/src/unix/pty.o
SOLINK_MODULE(target) Release/obj.target/pty.node
COPY Release/pty.node
gmake: Leaving directory '/usr/home/console/src/rowheel/node-pty/build'
gyp info ok
$ node scripts/post-install.js
$ npm run build
> node-pty@0.10.0 build
> tsc -b ./src/tsconfig.json
Done in 15.09s.
Per documented in https://www.gnu.org/software/gnulib/manual/html_node/forkpty.html:
See also: https://github.com/coder/code-server/issues/5741