Skip to content

Commit f3e7b87

Browse files
committed
Merge branch 'main' into add-argv0-support
2 parents 7fe4faa + 4c5aa31 commit f3e7b87

35 files changed

+4599
-2944
lines changed

.config/tsaoptions.json

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"codebaseName": "devdiv_microsoft_vscode_node_pty",
3+
"instanceUrl": "https://devdiv.visualstudio.com/defaultcollection",
4+
"projectName": "DevDiv",
5+
"areaPath": "DevDiv\\VS Code (compliance tracking only)\\Visual Studio Code NPM Packages",
6+
"notificationAliases": [
7+
8+
9+
]
10+
}

.eslintrc.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ module.exports = {
99
"project": "src/tsconfig.json",
1010
"sourceType": "module"
1111
},
12-
"ignorePatterns": "**/typings/*.d.ts",
12+
"ignorePatterns": [
13+
"**/typings/*.d.ts",
14+
"scripts/**/*"
15+
],
1316
"plugins": [
1417
"@typescript-eslint"
1518
],

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ node_modules/
88
builderror.log
99
lib/
1010
npm-debug.log
11-
package-lock.json
1211
fixtures/space folder/
1312
.vscode/settings.json
1413
.vscode/ipch/
14+
yarn.lock

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ npm install --global --production windows-build-tools
104104
The following are also needed:
105105

106106
- [Windows SDK](https://developer.microsoft.com/en-us/windows/downloads/windows-10-sdk) - only the "Desktop C++ Apps" components are needed to be installed
107+
- Spectre-mitigated libraries - In order to avoid the build error "MSB8040: Spectre-mitigated libraries are required for this project", open the Visual Studio Installer, press the Modify button, navigate to the "Individual components" tab, search "Spectre", and install an option like "MSVC v143 - VS 2022 C++ x64/x86 Spectre-mitigated libs (Latest)" (the exact option to install will depend on your version of Visual Studio as well as your operating system architecture)
107108

108109
## Debugging
109110

azure-pipelines.yml

+64-90
Original file line numberDiff line numberDiff line change
@@ -3,96 +3,70 @@
33
# Add steps that analyze code, save build artifacts, deploy, and more:
44
# https://docs.microsoft.com/azure/devops/pipelines/languages/javascript
55

6-
jobs:
7-
- job: Linux
8-
pool:
9-
vmImage: 'ubuntu-latest'
10-
strategy:
11-
matrix:
12-
node_16_x:
13-
node_version: 16.x
14-
node_18_x:
15-
node_version: 18.x
16-
steps:
17-
- task: NodeTool@0
18-
inputs:
19-
versionSpec: $(node_version)
20-
displayName: 'Install Node.js'
21-
- script: |
22-
npm i
23-
displayName: 'Install dependencies and build'
24-
- script: |
25-
npm test
26-
displayName: 'Test'
27-
- script: |
28-
npm run lint
29-
displayName: 'Lint'
6+
resources:
7+
repositories:
8+
- repository: 1esPipelines
9+
type: git
10+
name: 1ESPipelineTemplates/1ESPipelineTemplates
11+
ref: refs/tags/release
3012

31-
- job: macOS
32-
pool:
33-
vmImage: 'macOS-latest'
34-
strategy:
35-
matrix:
36-
node_16_x:
37-
node_version: 16.x
38-
node_18_x:
39-
node_version: 18.x
40-
steps:
41-
- task: NodeTool@0
42-
inputs:
43-
versionSpec: $(node_version)
44-
displayName: 'Install Node.js'
45-
- script: |
46-
npm i
47-
displayName: 'Install dependencies and build'
48-
- script: |
49-
npm test
50-
displayName: 'Test'
51-
- script: |
52-
npm run lint
53-
displayName: 'Lint'
13+
extends:
14+
template: v1/1ES.Official.PipelineTemplate.yml@1esPipelines
15+
parameters:
16+
sdl:
17+
sourceAnalysisPool: 1es-oss-windows-2022-x64
18+
tsa:
19+
enabled: true
20+
stages:
21+
- stage: Build
22+
jobs:
23+
- job: Linux
24+
pool:
25+
name: 1es-oss-ubuntu-22.04-x64
26+
os: Linux
27+
steps:
28+
- task: NodeTool@0
29+
inputs:
30+
versionSpec: 20.x
31+
displayName: 'Install Node.js'
32+
- script: npm ci
33+
displayName: 'Install dependencies and build'
34+
- script: npm test
35+
displayName: 'Test'
36+
- script: npm run lint
37+
displayName: 'Lint'
5438

55-
- job: Windows
56-
pool:
57-
vmImage: 'windows-2019'
58-
strategy:
59-
matrix:
60-
node_16_x:
61-
node_version: 16.x
62-
node_18_x:
63-
node_version: 18.x
64-
steps:
65-
- task: NodeTool@0
66-
inputs:
67-
versionSpec: $(node_version)
68-
displayName: 'Install Node.js'
69-
- script: |
70-
npm i
71-
displayName: 'Install dependencies and build'
72-
- script: |
73-
npm test
74-
displayName: 'Test'
75-
- script: |
76-
npm run lint
77-
displayName: 'Lint'
78-
79-
- job: Release
80-
dependsOn:
81-
- Linux
82-
- macOS
83-
- Windows
84-
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main'))
85-
pool:
86-
vmImage: 'ubuntu-latest'
87-
steps:
88-
- task: NodeTool@0
89-
inputs:
90-
versionSpec: '16.x'
91-
displayName: 'Install Node.js'
92-
- script: |
93-
npm i
94-
displayName: 'Install dependencies and build'
95-
- script: |
96-
NPM_AUTH_TOKEN="$(NPM_AUTH_TOKEN)" node ./scripts/publish.js
97-
displayName: 'Publish to npm'
39+
- job: macOS
40+
pool:
41+
name: Azure Pipelines
42+
vmImage: 'macOS-14'
43+
os: macOS
44+
steps:
45+
- task: NodeTool@0
46+
inputs:
47+
versionSpec: 20.x
48+
displayName: 'Install Node.js'
49+
- script: python3 -m pip install setuptools
50+
displayName: Install setuptools (macOS)
51+
- script: npm ci
52+
displayName: 'Install dependencies and build'
53+
- script: npm test
54+
displayName: 'Test'
55+
- script: npm run lint
56+
displayName: 'Lint'
9857

58+
- job: Windows
59+
pool:
60+
name: 1es-oss-windows-2022-x64
61+
os: Windows
62+
steps:
63+
- task: NodeTool@0
64+
inputs:
65+
versionSpec: 20.x
66+
displayName: 'Install Node.js'
67+
- script: npm ci
68+
displayName: 'Install dependencies and build'
69+
- script: npm test
70+
displayName: 'Test'
71+
- script: npm run lint
72+
displayName: 'Lint'

binding.gyp

+4-15
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
{
22
'target_defaults': {
3+
'dependencies': [
4+
"<!(node -p \"require('node-addon-api').targets\"):node_addon_api_except",
5+
],
36
'conditions': [
47
['OS=="win"', {
58
'msvs_configuration_attributes': {
@@ -28,9 +31,6 @@
2831
'targets': [
2932
{
3033
'target_name': 'conpty',
31-
'include_dirs' : [
32-
'<!(node -e "require(\'nan\')")'
33-
],
3434
'sources' : [
3535
'src/win/conpty.cc',
3636
'src/win/path_util.cc'
@@ -41,17 +41,14 @@
4141
},
4242
{
4343
'target_name': 'conpty_console_list',
44-
'include_dirs' : [
45-
'<!(node -e "require(\'nan\')")'
46-
],
4744
'sources' : [
4845
'src/win/conpty_console_list.cc'
4946
],
5047
},
5148
{
5249
'target_name': 'pty',
5350
'include_dirs' : [
54-
'<!(node -e "require(\'nan\')")',
51+
'<!(node -p "require(\'node-addon-api\').include_dir")',
5552
'deps/winpty/src/include',
5653
],
5754
# Disabled due to winpty
@@ -73,9 +70,6 @@
7370
'targets': [
7471
{
7572
'target_name': 'pty',
76-
'include_dirs' : [
77-
'<!(node -e "require(\'nan\')")'
78-
],
7973
'sources': [
8074
'src/unix/pty.cc',
8175
],
@@ -91,11 +85,6 @@
9185
'libraries!': [
9286
'-lutil'
9387
]
94-
}],
95-
['OS=="mac"', {
96-
"xcode_settings": {
97-
"MACOSX_DEPLOYMENT_TARGET":"10.7"
98-
}
9988
}]
10089
]
10190
}

deps/winpty/src/agent/Agent.cc

+11-3
Original file line numberDiff line numberDiff line change
@@ -224,9 +224,17 @@ Agent::Agent(LPCWSTR controlPipeName,
224224
Agent::~Agent()
225225
{
226226
trace("Agent::~Agent entered");
227-
agentShutdown();
228-
if (m_childProcess != NULL) {
229-
CloseHandle(m_childProcess);
227+
try {
228+
agentShutdown();
229+
if (m_childProcess != NULL) {
230+
CloseHandle(m_childProcess);
231+
}
232+
} catch (const std::exception &e) {
233+
// Log the exception or handle it as needed
234+
trace("Exception in Agent::~Agent: %s", e.what());
235+
} catch (...) {
236+
// Catch any other types of exceptions
237+
trace("Unknown exception in Agent::~Agent");
230238
}
231239
}
232240

examples/fork/index.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ const ptyProcess = pty.spawn(shell, [], {
1010
rows: 26,
1111
cwd: isWindows ? process.env.USERPROFILE : process.env.HOME,
1212
env: Object.assign({ TEST: "Environment vars work" }, process.env),
13-
useConpty: true
13+
useConpty: true,
14+
useConptyDll: true
1415
});
1516

1617
ptyProcess.onData(data => process.stdout.write(data));

0 commit comments

Comments
 (0)