Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

POSIX Spawn 2: Electric Boogaloo #487

Merged
merged 19 commits into from
Dec 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 45 additions & 27 deletions binding.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -46,33 +46,51 @@
}
]
}, { # OS!="win"
'targets': [{
'target_name': 'pty',
'include_dirs' : [
'<!(node -e "require(\'nan\')")'
],
'sources': [
'src/unix/pty.cc'
],
'libraries': [
'-lutil'
],
'conditions': [
# http://www.gnu.org/software/gnulib/manual/html_node/forkpty.html
# One some systems (at least including Cygwin, Interix,
# OSF/1 4 and 5, and Mac OS X) linking with -lutil is not required.
['OS=="mac" or OS=="solaris"', {
'libraries!': [
'-lutil'
]
}],
['OS=="mac"', {
"xcode_settings": {
"MACOSX_DEPLOYMENT_TARGET":"10.7"
}
}]
]
}]
'targets': [
{
'target_name': 'spawn-helper',
'type': 'executable',
'cflags': ['-Wall'],
'sources': [
'src/unix/spawn-helper.cc',
],
'conditions': [
['OS=="mac"', {
"xcode_settings": {
"MACOSX_DEPLOYMENT_TARGET":"10.7"
}
}]
]
},
{
'target_name': 'pty',
'include_dirs' : [
'<!(node -e "require(\'nan\')")'
],
'sources': [
'src/unix/pty.cc',
],
'libraries': [
'-lutil'
],
'cflags': ['-Wall'],
'conditions': [
# http://www.gnu.org/software/gnulib/manual/html_node/forkpty.html
# One some systems (at least including Cygwin, Interix,
# OSF/1 4 and 5, and Mac OS X) linking with -lutil is not required.
['OS=="mac" or OS=="solaris"', {
'libraries!': [
'-lutil'
]
}],
['OS=="mac"', {
"xcode_settings": {
"MACOSX_DEPLOYMENT_TARGET":"10.7"
}
}]
]
}
]
}]
]
}
1 change: 1 addition & 0 deletions scripts/post-install.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ var BUILD_FILES = [
path.join(RELEASE_DIR, 'conpty_console_list.pdb'),
path.join(RELEASE_DIR, 'pty.node'),
path.join(RELEASE_DIR, 'pty.pdb'),
path.join(RELEASE_DIR, 'spawn-helper'),
path.join(RELEASE_DIR, 'winpty-agent.exe'),
path.join(RELEASE_DIR, 'winpty-agent.pdb'),
path.join(RELEASE_DIR, 'winpty.dll'),
Expand Down
1 change: 1 addition & 0 deletions src/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ interface IBasePtyForkOptions {
export interface IPtyForkOptions extends IBasePtyForkOptions {
uid?: number;
gid?: number;
closeFDs?: boolean;
}

export interface IWindowsPtyForkOptions extends IBasePtyForkOptions {
Expand Down
2 changes: 1 addition & 1 deletion src/native.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ interface IWinptyNative {
}

interface IUnixNative {
fork(file: string, args: string[], parsedEnv: string[], cwd: string, cols: number, rows: number, uid: number, gid: number, useUtf8: boolean, onExitCallback: (code: number, signal: number) => void): IUnixProcess;
fork(file: string, args: string[], parsedEnv: string[], cwd: string, cols: number, rows: number, uid: number, gid: number, closeFDs: boolean, useUtf8: boolean, onExitCallback: (code: number, signal: number) => void, helperPath: string): IUnixProcess;
open(cols: number, rows: number): IUnixOpenProcess;
process(fd: number, pty: string): string;
resize(fd: number, cols: number, rows: number): void;
Expand Down
5 changes: 5 additions & 0 deletions src/unix/comms.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#define COMM_PIPE_FD (STDERR_FILENO + 1)
#define COMM_ERR_EXEC 1
#define COMM_ERR_CHDIR 2
#define COMM_ERR_SETUID 3
#define COMM_ERR_SETGID 4
Loading