@theia/process 1.48.1 → 1.48.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +30 -30
- package/lib/common/process-common-module.d.ts +3 -3
- package/lib/common/process-common-module.js +22 -22
- package/lib/common/process-manager-types.d.ts +35 -35
- package/lib/common/process-manager-types.js +23 -23
- package/lib/common/shell-command-builder.d.ts +49 -49
- package/lib/common/shell-command-builder.js +169 -169
- package/lib/common/shell-command-builder.slow-spec.d.ts +9 -9
- package/lib/common/shell-command-builder.slow-spec.js +404 -404
- package/lib/common/shell-quoting.d.ts +91 -91
- package/lib/common/shell-quoting.js +145 -145
- package/lib/common/shell-quoting.spec.d.ts +1 -1
- package/lib/common/shell-quoting.spec.js +170 -170
- package/lib/node/dev-null-stream.d.ts +17 -17
- package/lib/node/dev-null-stream.js +41 -41
- package/lib/node/index.d.ts +6 -6
- package/lib/node/index.js +24 -24
- package/lib/node/multi-ring-buffer.d.ts +68 -68
- package/lib/node/multi-ring-buffer.js +299 -299
- package/lib/node/multi-ring-buffer.spec.d.ts +1 -1
- package/lib/node/multi-ring-buffer.spec.js +422 -422
- package/lib/node/process-backend-module.d.ts +3 -3
- package/lib/node/process-backend-module.js +56 -56
- package/lib/node/process-manager.d.ts +33 -33
- package/lib/node/process-manager.js +102 -102
- package/lib/node/process.d.ts +95 -95
- package/lib/node/process.js +142 -142
- package/lib/node/pseudo-pty.d.ts +22 -22
- package/lib/node/pseudo-pty.js +38 -38
- package/lib/node/raw-process.d.ts +45 -45
- package/lib/node/raw-process.js +104 -104
- package/lib/node/raw-process.spec.d.ts +1 -1
- package/lib/node/raw-process.spec.js +164 -164
- package/lib/node/task-terminal-process.d.ts +10 -10
- package/lib/node/task-terminal-process.js +42 -42
- package/lib/node/terminal-process.d.ts +60 -60
- package/lib/node/terminal-process.js +248 -248
- package/lib/node/terminal-process.spec.d.ts +1 -1
- package/lib/node/terminal-process.spec.js +103 -103
- package/lib/node/test/process-test-container.d.ts +2 -2
- package/lib/node/test/process-test-container.js +28 -28
- package/lib/node/utils.d.ts +16 -16
- package/lib/node/utils.js +77 -77
- package/package.json +4 -4
- package/src/common/process-common-module.ts +22 -22
- package/src/common/process-manager-types.ts +58 -58
- package/src/common/shell-command-builder.slow-spec.ts +486 -486
- package/src/common/shell-command-builder.ts +187 -187
- package/src/common/shell-quoting.spec.ts +176 -176
- package/src/common/shell-quoting.ts +236 -236
- package/src/common/tests/$weird(),file=name.js +1 -1
- package/src/common/tests/white space.js +1 -1
- package/src/node/dev-null-stream.ts +47 -47
- package/src/node/index.ts +22 -22
- package/src/node/multi-ring-buffer.spec.ts +486 -486
- package/src/node/multi-ring-buffer.ts +348 -348
- package/src/node/process-backend-module.ts +67 -67
- package/src/node/process-manager.ts +107 -107
- package/src/node/process.ts +207 -207
- package/src/node/pseudo-pty.ts +54 -54
- package/src/node/raw-process.spec.ts +199 -199
- package/src/node/raw-process.ts +156 -156
- package/src/node/string-argv.d.ts +21 -21
- package/src/node/task-terminal-process.ts +41 -41
- package/src/node/terminal-process.spec.ts +121 -121
- package/src/node/terminal-process.ts +290 -290
- package/src/node/test/process-fork-test.js +22 -22
- package/src/node/test/process-test-container.ts +27 -27
- package/src/node/utils.ts +79 -79
|
@@ -1,171 +1,171 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// *****************************************************************************
|
|
3
|
-
// Copyright (C) 2020 Ericsson and others.
|
|
4
|
-
//
|
|
5
|
-
// This program and the accompanying materials are made available under the
|
|
6
|
-
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
-
// http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
-
//
|
|
9
|
-
// This Source Code may also be made available under the following Secondary
|
|
10
|
-
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
-
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
-
// with the GNU Classpath Exception which is available at
|
|
13
|
-
// https://www.gnu.org/software/classpath/license.html.
|
|
14
|
-
//
|
|
15
|
-
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
16
|
-
// *****************************************************************************
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
const chai_1 = require("chai");
|
|
19
|
-
const shell_quoting_1 = require("./shell-quoting");
|
|
20
|
-
describe('Shell arguments escaping:', () => {
|
|
21
|
-
// Procedurally execute tests from this list of data.
|
|
22
|
-
const testData = {
|
|
23
|
-
bash: {
|
|
24
|
-
// https://www.gnu.org/software/bash/manual/html_node/Quoting.html
|
|
25
|
-
quotingFunctions: shell_quoting_1.BashQuotingFunctions,
|
|
26
|
-
data: {
|
|
27
|
-
["escape" /* Escape */]: [
|
|
28
|
-
{ input: 'abc', expected: 'abc' },
|
|
29
|
-
{ input: 'ab c', expected: 'ab\\ c' },
|
|
30
|
-
{ input: 'ab"c', expected: 'ab\\"c' },
|
|
31
|
-
{ input: 'ab\'c', expected: 'ab\\\'c' },
|
|
32
|
-
{ input: 'ab\\ c\\', expected: 'ab\\\\\\ c\\\\' },
|
|
33
|
-
{
|
|
34
|
-
input: 'setTimeout(() => { console.log(1, "2\'3"); }, 100)',
|
|
35
|
-
expected: 'setTimeout\\(\\(\\)\\ =\\>\\ \\{\\ console.log\\(1,\\ \\"2\\\'3\\"\\)\\;\\ \\},\\ 100\\)',
|
|
36
|
-
},
|
|
37
|
-
],
|
|
38
|
-
["strong" /* Strong */]: [
|
|
39
|
-
{ input: 'abc', expected: '\'abc\'' },
|
|
40
|
-
{ input: 'ab c', expected: '\'ab c\'' },
|
|
41
|
-
{ input: 'ab"c', expected: '\'ab"c\'' },
|
|
42
|
-
{ input: 'ab\'c', expected: '\'ab\'"\'"\'c\'' },
|
|
43
|
-
{ input: 'ab\\ c\\', expected: '\'ab\\ c\\\'' },
|
|
44
|
-
{
|
|
45
|
-
input: 'setTimeout(() => { console.log(1, "2\'3"); }, 100)',
|
|
46
|
-
expected: '\'setTimeout(() => { console.log(1, "2\'"\'"\'3"); }, 100)\'',
|
|
47
|
-
},
|
|
48
|
-
],
|
|
49
|
-
["weak" /* Weak */]: [
|
|
50
|
-
{ input: 'abc', expected: '"abc"' },
|
|
51
|
-
{ input: 'ab c', expected: '"ab c"' },
|
|
52
|
-
{ input: 'ab"c', expected: '"ab\\"c"' },
|
|
53
|
-
{ input: 'ab\'c', expected: '"ab\'c"' },
|
|
54
|
-
{ input: 'ab\\ c\\', expected: '"ab\\ c\\\\"' },
|
|
55
|
-
{
|
|
56
|
-
input: 'setTimeout(() => { console.log(1, "2\'3"); }, 100)',
|
|
57
|
-
expected: '"setTimeout(() => { console.log(1, \\"2\'3\\"); }, 100)"',
|
|
58
|
-
},
|
|
59
|
-
]
|
|
60
|
-
},
|
|
61
|
-
},
|
|
62
|
-
cmd: {
|
|
63
|
-
// https://ss64.com/nt/syntax-esc.html
|
|
64
|
-
quotingFunctions: shell_quoting_1.CmdQuotingFunctions,
|
|
65
|
-
data: {
|
|
66
|
-
["escape" /* Escape */]: [
|
|
67
|
-
{ input: 'abc', expected: 'abc' },
|
|
68
|
-
{ input: 'ab c', expected: 'ab" "c' },
|
|
69
|
-
{ input: 'ab"c', expected: 'ab\\"c' },
|
|
70
|
-
{ input: 'ab\'c', expected: 'ab\'c' },
|
|
71
|
-
{ input: 'ab^ c^', expected: 'ab^^" "c^^' },
|
|
72
|
-
{
|
|
73
|
-
input: 'setTimeout(() => { console.log(1, "2\'3"); }, 100)',
|
|
74
|
-
expected: 'setTimeout^(^(^)" "=^>" "{" "console.log^(1," "\\"2\'3\\"^);" "}," "100^)',
|
|
75
|
-
},
|
|
76
|
-
{
|
|
77
|
-
input: 'console.log("%PATH%")',
|
|
78
|
-
expected: 'console.log^(\\"^%PATH^%\\"^)',
|
|
79
|
-
},
|
|
80
|
-
],
|
|
81
|
-
["strong" /* Strong */]: [
|
|
82
|
-
{ input: 'abc', expected: '"abc"' },
|
|
83
|
-
{ input: 'ab c', expected: '"ab c"' },
|
|
84
|
-
{ input: 'ab"c', expected: '"ab\\"c"' },
|
|
85
|
-
{ input: 'ab\'c', expected: '"ab\'c"' },
|
|
86
|
-
{ input: 'ab^ c^', expected: '"ab^^ c^^"' },
|
|
87
|
-
{
|
|
88
|
-
input: 'setTimeout(() => { console.log(1, "2\'3"); }, 100)',
|
|
89
|
-
expected: '"setTimeout^(^(^) =^> { console.log^(1, \\"2\'3\\"^); }, 100^)"',
|
|
90
|
-
},
|
|
91
|
-
{
|
|
92
|
-
input: 'console.log("%PATH%")',
|
|
93
|
-
expected: '"console.log^(\\""%"PATH"%"\\"^)"',
|
|
94
|
-
},
|
|
95
|
-
],
|
|
96
|
-
["weak" /* Weak */]: [
|
|
97
|
-
{ input: 'abc', expected: '"abc"' },
|
|
98
|
-
{ input: 'ab c', expected: '"ab c"' },
|
|
99
|
-
{ input: 'ab"c', expected: '"ab\\"c"' },
|
|
100
|
-
{ input: 'ab\'c', expected: '"ab\'c"' },
|
|
101
|
-
{ input: 'ab^ c^', expected: '"ab^^ c^^"' },
|
|
102
|
-
{
|
|
103
|
-
input: 'setTimeout(() => { console.log(1, "2\'3"); }, 100)',
|
|
104
|
-
expected: '"setTimeout^(^(^) =^> { console.log^(1, \\"2\'3\\"^); }, 100^)"',
|
|
105
|
-
},
|
|
106
|
-
{
|
|
107
|
-
input: 'console.log("%PATH%")',
|
|
108
|
-
expected: '"console.log^(\\"%PATH%\\"^)"',
|
|
109
|
-
},
|
|
110
|
-
]
|
|
111
|
-
},
|
|
112
|
-
},
|
|
113
|
-
powershell: {
|
|
114
|
-
// https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_quoting_rules?view=powershell-6
|
|
115
|
-
quotingFunctions: shell_quoting_1.PowershellQuotingFunctions,
|
|
116
|
-
data: {
|
|
117
|
-
["escape" /* Escape */]: [
|
|
118
|
-
{ input: 'abc', expected: 'abc' },
|
|
119
|
-
{ input: 'ab c', expected: 'ab` c' },
|
|
120
|
-
{ input: 'ab"c', expected: 'ab`"c' },
|
|
121
|
-
{ input: 'ab\'c', expected: 'ab`\'c' },
|
|
122
|
-
{ input: 'ab` c`', expected: 'ab``` c``' },
|
|
123
|
-
{
|
|
124
|
-
input: 'setTimeout(() => { console.log(1, "2\'3"); }, 100)',
|
|
125
|
-
expected: 'setTimeout`(`(`)` =`>` `{` console.log`(1,` `"2`\'3`"`)`;` `},` 100`)',
|
|
126
|
-
},
|
|
127
|
-
],
|
|
128
|
-
["strong" /* Strong */]: [
|
|
129
|
-
{ input: 'abc', expected: '\'abc\'' },
|
|
130
|
-
{ input: 'ab c', expected: '\'ab c\'' },
|
|
131
|
-
{ input: 'ab"c', expected: '\'ab"c\'' },
|
|
132
|
-
{ input: 'ab\'c', expected: '\'ab\'\'c\'' },
|
|
133
|
-
{ input: 'ab` c`', expected: '\'ab` c`\'' },
|
|
134
|
-
{
|
|
135
|
-
input: 'setTimeout(() => { console.log(1, "2\'3"); }, 100)',
|
|
136
|
-
expected: '\'setTimeout(() => { console.log(1, "2\'\'3"); }, 100)\'',
|
|
137
|
-
},
|
|
138
|
-
],
|
|
139
|
-
["weak" /* Weak */]: [
|
|
140
|
-
{ input: 'abc', expected: '"abc"' },
|
|
141
|
-
{ input: 'ab c', expected: '"ab c"' },
|
|
142
|
-
{ input: 'ab"c', expected: '"ab`"c"' },
|
|
143
|
-
{ input: 'ab\'c', expected: '"ab\'c"' },
|
|
144
|
-
{ input: 'ab` c`', expected: '"ab` c``"' },
|
|
145
|
-
{
|
|
146
|
-
input: 'setTimeout(() => { console.log(1, "2\'3"); }, 100)',
|
|
147
|
-
expected: '"setTimeout(() => { console.log(1, `"2\'3`"); }, 100)"',
|
|
148
|
-
},
|
|
149
|
-
]
|
|
150
|
-
},
|
|
151
|
-
}
|
|
152
|
-
};
|
|
153
|
-
// Iter through each runtime (bash/cmd/powershell):
|
|
154
|
-
for (const runtime of Object.keys(testData)) {
|
|
155
|
-
const testInfo = testData[runtime];
|
|
156
|
-
// Get all quoting types (escape/strong/weak):
|
|
157
|
-
for (const quotingType of Object.keys(testInfo.data)) {
|
|
158
|
-
const testInput = testInfo.data[quotingType];
|
|
159
|
-
// Run the test for each input:
|
|
160
|
-
it(`${runtime}/${quotingType}`, () => {
|
|
161
|
-
for (const test of testInput) {
|
|
162
|
-
(0, chai_1.expect)((0, shell_quoting_1.escapeForShell)({
|
|
163
|
-
quoting: quotingType,
|
|
164
|
-
value: test.input,
|
|
165
|
-
}, testInfo.quotingFunctions)).equal(test.expected);
|
|
166
|
-
}
|
|
167
|
-
});
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
});
|
|
1
|
+
"use strict";
|
|
2
|
+
// *****************************************************************************
|
|
3
|
+
// Copyright (C) 2020 Ericsson and others.
|
|
4
|
+
//
|
|
5
|
+
// This program and the accompanying materials are made available under the
|
|
6
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
+
//
|
|
9
|
+
// This Source Code may also be made available under the following Secondary
|
|
10
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
+
// with the GNU Classpath Exception which is available at
|
|
13
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
14
|
+
//
|
|
15
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
16
|
+
// *****************************************************************************
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
const chai_1 = require("chai");
|
|
19
|
+
const shell_quoting_1 = require("./shell-quoting");
|
|
20
|
+
describe('Shell arguments escaping:', () => {
|
|
21
|
+
// Procedurally execute tests from this list of data.
|
|
22
|
+
const testData = {
|
|
23
|
+
bash: {
|
|
24
|
+
// https://www.gnu.org/software/bash/manual/html_node/Quoting.html
|
|
25
|
+
quotingFunctions: shell_quoting_1.BashQuotingFunctions,
|
|
26
|
+
data: {
|
|
27
|
+
["escape" /* Escape */]: [
|
|
28
|
+
{ input: 'abc', expected: 'abc' },
|
|
29
|
+
{ input: 'ab c', expected: 'ab\\ c' },
|
|
30
|
+
{ input: 'ab"c', expected: 'ab\\"c' },
|
|
31
|
+
{ input: 'ab\'c', expected: 'ab\\\'c' },
|
|
32
|
+
{ input: 'ab\\ c\\', expected: 'ab\\\\\\ c\\\\' },
|
|
33
|
+
{
|
|
34
|
+
input: 'setTimeout(() => { console.log(1, "2\'3"); }, 100)',
|
|
35
|
+
expected: 'setTimeout\\(\\(\\)\\ =\\>\\ \\{\\ console.log\\(1,\\ \\"2\\\'3\\"\\)\\;\\ \\},\\ 100\\)',
|
|
36
|
+
},
|
|
37
|
+
],
|
|
38
|
+
["strong" /* Strong */]: [
|
|
39
|
+
{ input: 'abc', expected: '\'abc\'' },
|
|
40
|
+
{ input: 'ab c', expected: '\'ab c\'' },
|
|
41
|
+
{ input: 'ab"c', expected: '\'ab"c\'' },
|
|
42
|
+
{ input: 'ab\'c', expected: '\'ab\'"\'"\'c\'' },
|
|
43
|
+
{ input: 'ab\\ c\\', expected: '\'ab\\ c\\\'' },
|
|
44
|
+
{
|
|
45
|
+
input: 'setTimeout(() => { console.log(1, "2\'3"); }, 100)',
|
|
46
|
+
expected: '\'setTimeout(() => { console.log(1, "2\'"\'"\'3"); }, 100)\'',
|
|
47
|
+
},
|
|
48
|
+
],
|
|
49
|
+
["weak" /* Weak */]: [
|
|
50
|
+
{ input: 'abc', expected: '"abc"' },
|
|
51
|
+
{ input: 'ab c', expected: '"ab c"' },
|
|
52
|
+
{ input: 'ab"c', expected: '"ab\\"c"' },
|
|
53
|
+
{ input: 'ab\'c', expected: '"ab\'c"' },
|
|
54
|
+
{ input: 'ab\\ c\\', expected: '"ab\\ c\\\\"' },
|
|
55
|
+
{
|
|
56
|
+
input: 'setTimeout(() => { console.log(1, "2\'3"); }, 100)',
|
|
57
|
+
expected: '"setTimeout(() => { console.log(1, \\"2\'3\\"); }, 100)"',
|
|
58
|
+
},
|
|
59
|
+
]
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
cmd: {
|
|
63
|
+
// https://ss64.com/nt/syntax-esc.html
|
|
64
|
+
quotingFunctions: shell_quoting_1.CmdQuotingFunctions,
|
|
65
|
+
data: {
|
|
66
|
+
["escape" /* Escape */]: [
|
|
67
|
+
{ input: 'abc', expected: 'abc' },
|
|
68
|
+
{ input: 'ab c', expected: 'ab" "c' },
|
|
69
|
+
{ input: 'ab"c', expected: 'ab\\"c' },
|
|
70
|
+
{ input: 'ab\'c', expected: 'ab\'c' },
|
|
71
|
+
{ input: 'ab^ c^', expected: 'ab^^" "c^^' },
|
|
72
|
+
{
|
|
73
|
+
input: 'setTimeout(() => { console.log(1, "2\'3"); }, 100)',
|
|
74
|
+
expected: 'setTimeout^(^(^)" "=^>" "{" "console.log^(1," "\\"2\'3\\"^);" "}," "100^)',
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
input: 'console.log("%PATH%")',
|
|
78
|
+
expected: 'console.log^(\\"^%PATH^%\\"^)',
|
|
79
|
+
},
|
|
80
|
+
],
|
|
81
|
+
["strong" /* Strong */]: [
|
|
82
|
+
{ input: 'abc', expected: '"abc"' },
|
|
83
|
+
{ input: 'ab c', expected: '"ab c"' },
|
|
84
|
+
{ input: 'ab"c', expected: '"ab\\"c"' },
|
|
85
|
+
{ input: 'ab\'c', expected: '"ab\'c"' },
|
|
86
|
+
{ input: 'ab^ c^', expected: '"ab^^ c^^"' },
|
|
87
|
+
{
|
|
88
|
+
input: 'setTimeout(() => { console.log(1, "2\'3"); }, 100)',
|
|
89
|
+
expected: '"setTimeout^(^(^) =^> { console.log^(1, \\"2\'3\\"^); }, 100^)"',
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
input: 'console.log("%PATH%")',
|
|
93
|
+
expected: '"console.log^(\\""%"PATH"%"\\"^)"',
|
|
94
|
+
},
|
|
95
|
+
],
|
|
96
|
+
["weak" /* Weak */]: [
|
|
97
|
+
{ input: 'abc', expected: '"abc"' },
|
|
98
|
+
{ input: 'ab c', expected: '"ab c"' },
|
|
99
|
+
{ input: 'ab"c', expected: '"ab\\"c"' },
|
|
100
|
+
{ input: 'ab\'c', expected: '"ab\'c"' },
|
|
101
|
+
{ input: 'ab^ c^', expected: '"ab^^ c^^"' },
|
|
102
|
+
{
|
|
103
|
+
input: 'setTimeout(() => { console.log(1, "2\'3"); }, 100)',
|
|
104
|
+
expected: '"setTimeout^(^(^) =^> { console.log^(1, \\"2\'3\\"^); }, 100^)"',
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
input: 'console.log("%PATH%")',
|
|
108
|
+
expected: '"console.log^(\\"%PATH%\\"^)"',
|
|
109
|
+
},
|
|
110
|
+
]
|
|
111
|
+
},
|
|
112
|
+
},
|
|
113
|
+
powershell: {
|
|
114
|
+
// https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_quoting_rules?view=powershell-6
|
|
115
|
+
quotingFunctions: shell_quoting_1.PowershellQuotingFunctions,
|
|
116
|
+
data: {
|
|
117
|
+
["escape" /* Escape */]: [
|
|
118
|
+
{ input: 'abc', expected: 'abc' },
|
|
119
|
+
{ input: 'ab c', expected: 'ab` c' },
|
|
120
|
+
{ input: 'ab"c', expected: 'ab`"c' },
|
|
121
|
+
{ input: 'ab\'c', expected: 'ab`\'c' },
|
|
122
|
+
{ input: 'ab` c`', expected: 'ab``` c``' },
|
|
123
|
+
{
|
|
124
|
+
input: 'setTimeout(() => { console.log(1, "2\'3"); }, 100)',
|
|
125
|
+
expected: 'setTimeout`(`(`)` =`>` `{` console.log`(1,` `"2`\'3`"`)`;` `},` 100`)',
|
|
126
|
+
},
|
|
127
|
+
],
|
|
128
|
+
["strong" /* Strong */]: [
|
|
129
|
+
{ input: 'abc', expected: '\'abc\'' },
|
|
130
|
+
{ input: 'ab c', expected: '\'ab c\'' },
|
|
131
|
+
{ input: 'ab"c', expected: '\'ab"c\'' },
|
|
132
|
+
{ input: 'ab\'c', expected: '\'ab\'\'c\'' },
|
|
133
|
+
{ input: 'ab` c`', expected: '\'ab` c`\'' },
|
|
134
|
+
{
|
|
135
|
+
input: 'setTimeout(() => { console.log(1, "2\'3"); }, 100)',
|
|
136
|
+
expected: '\'setTimeout(() => { console.log(1, "2\'\'3"); }, 100)\'',
|
|
137
|
+
},
|
|
138
|
+
],
|
|
139
|
+
["weak" /* Weak */]: [
|
|
140
|
+
{ input: 'abc', expected: '"abc"' },
|
|
141
|
+
{ input: 'ab c', expected: '"ab c"' },
|
|
142
|
+
{ input: 'ab"c', expected: '"ab`"c"' },
|
|
143
|
+
{ input: 'ab\'c', expected: '"ab\'c"' },
|
|
144
|
+
{ input: 'ab` c`', expected: '"ab` c``"' },
|
|
145
|
+
{
|
|
146
|
+
input: 'setTimeout(() => { console.log(1, "2\'3"); }, 100)',
|
|
147
|
+
expected: '"setTimeout(() => { console.log(1, `"2\'3`"); }, 100)"',
|
|
148
|
+
},
|
|
149
|
+
]
|
|
150
|
+
},
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
// Iter through each runtime (bash/cmd/powershell):
|
|
154
|
+
for (const runtime of Object.keys(testData)) {
|
|
155
|
+
const testInfo = testData[runtime];
|
|
156
|
+
// Get all quoting types (escape/strong/weak):
|
|
157
|
+
for (const quotingType of Object.keys(testInfo.data)) {
|
|
158
|
+
const testInput = testInfo.data[quotingType];
|
|
159
|
+
// Run the test for each input:
|
|
160
|
+
it(`${runtime}/${quotingType}`, () => {
|
|
161
|
+
for (const test of testInput) {
|
|
162
|
+
(0, chai_1.expect)((0, shell_quoting_1.escapeForShell)({
|
|
163
|
+
quoting: quotingType,
|
|
164
|
+
value: test.input,
|
|
165
|
+
}, testInfo.quotingFunctions)).equal(test.expected);
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
});
|
|
171
171
|
//# sourceMappingURL=shell-quoting.spec.js.map
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import stream = require('stream');
|
|
3
|
-
/**
|
|
4
|
-
* A Node stream like `/dev/null`.
|
|
5
|
-
*
|
|
6
|
-
* Writing goes to a black hole, reading returns `EOF`.
|
|
7
|
-
*/
|
|
8
|
-
export declare class DevNullStream extends stream.Duplex {
|
|
9
|
-
constructor(options?: {
|
|
10
|
-
/**
|
|
11
|
-
* Makes this stream call `destroy` on itself, emitting the `close` event.
|
|
12
|
-
*/
|
|
13
|
-
autoDestroy?: boolean;
|
|
14
|
-
});
|
|
15
|
-
_write(chunk: any, encoding: string, callback: (err?: Error) => void): void;
|
|
16
|
-
_read(size: number): void;
|
|
17
|
-
}
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import stream = require('stream');
|
|
3
|
+
/**
|
|
4
|
+
* A Node stream like `/dev/null`.
|
|
5
|
+
*
|
|
6
|
+
* Writing goes to a black hole, reading returns `EOF`.
|
|
7
|
+
*/
|
|
8
|
+
export declare class DevNullStream extends stream.Duplex {
|
|
9
|
+
constructor(options?: {
|
|
10
|
+
/**
|
|
11
|
+
* Makes this stream call `destroy` on itself, emitting the `close` event.
|
|
12
|
+
*/
|
|
13
|
+
autoDestroy?: boolean;
|
|
14
|
+
});
|
|
15
|
+
_write(chunk: any, encoding: string, callback: (err?: Error) => void): void;
|
|
16
|
+
_read(size: number): void;
|
|
17
|
+
}
|
|
18
18
|
//# sourceMappingURL=dev-null-stream.d.ts.map
|
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// *****************************************************************************
|
|
3
|
-
// Copyright (C) 2019 Ericsson and others.
|
|
4
|
-
//
|
|
5
|
-
// This program and the accompanying materials are made available under the
|
|
6
|
-
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
-
// http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
-
//
|
|
9
|
-
// This Source Code may also be made available under the following Secondary
|
|
10
|
-
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
-
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
-
// with the GNU Classpath Exception which is available at
|
|
13
|
-
// https://www.gnu.org/software/classpath/license.html.
|
|
14
|
-
//
|
|
15
|
-
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
16
|
-
// *****************************************************************************
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.DevNullStream = void 0;
|
|
19
|
-
const stream = require("stream");
|
|
20
|
-
/**
|
|
21
|
-
* A Node stream like `/dev/null`.
|
|
22
|
-
*
|
|
23
|
-
* Writing goes to a black hole, reading returns `EOF`.
|
|
24
|
-
*/
|
|
25
|
-
class DevNullStream extends stream.Duplex {
|
|
26
|
-
constructor(options = {}) {
|
|
27
|
-
super();
|
|
28
|
-
if (options.autoDestroy) {
|
|
29
|
-
this.destroy();
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
33
|
-
_write(chunk, encoding, callback) {
|
|
34
|
-
callback();
|
|
35
|
-
}
|
|
36
|
-
_read(size) {
|
|
37
|
-
// eslint-disable-next-line no-null/no-null
|
|
38
|
-
this.push(null);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
exports.DevNullStream = DevNullStream;
|
|
1
|
+
"use strict";
|
|
2
|
+
// *****************************************************************************
|
|
3
|
+
// Copyright (C) 2019 Ericsson and others.
|
|
4
|
+
//
|
|
5
|
+
// This program and the accompanying materials are made available under the
|
|
6
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
+
//
|
|
9
|
+
// This Source Code may also be made available under the following Secondary
|
|
10
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
+
// with the GNU Classpath Exception which is available at
|
|
13
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
14
|
+
//
|
|
15
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
16
|
+
// *****************************************************************************
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.DevNullStream = void 0;
|
|
19
|
+
const stream = require("stream");
|
|
20
|
+
/**
|
|
21
|
+
* A Node stream like `/dev/null`.
|
|
22
|
+
*
|
|
23
|
+
* Writing goes to a black hole, reading returns `EOF`.
|
|
24
|
+
*/
|
|
25
|
+
class DevNullStream extends stream.Duplex {
|
|
26
|
+
constructor(options = {}) {
|
|
27
|
+
super();
|
|
28
|
+
if (options.autoDestroy) {
|
|
29
|
+
this.destroy();
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
33
|
+
_write(chunk, encoding, callback) {
|
|
34
|
+
callback();
|
|
35
|
+
}
|
|
36
|
+
_read(size) {
|
|
37
|
+
// eslint-disable-next-line no-null/no-null
|
|
38
|
+
this.push(null);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
exports.DevNullStream = DevNullStream;
|
|
42
42
|
//# sourceMappingURL=dev-null-stream.js.map
|
package/lib/node/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export * from './process-manager';
|
|
2
|
-
export * from './process';
|
|
3
|
-
export * from './raw-process';
|
|
4
|
-
export * from './terminal-process';
|
|
5
|
-
export * from './task-terminal-process';
|
|
6
|
-
export * from './multi-ring-buffer';
|
|
1
|
+
export * from './process-manager';
|
|
2
|
+
export * from './process';
|
|
3
|
+
export * from './raw-process';
|
|
4
|
+
export * from './terminal-process';
|
|
5
|
+
export * from './task-terminal-process';
|
|
6
|
+
export * from './multi-ring-buffer';
|
|
7
7
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/node/index.js
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// *****************************************************************************
|
|
3
|
-
// Copyright (C) 2017 Ericsson and others.
|
|
4
|
-
//
|
|
5
|
-
// This program and the accompanying materials are made available under the
|
|
6
|
-
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
-
// http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
-
//
|
|
9
|
-
// This Source Code may also be made available under the following Secondary
|
|
10
|
-
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
-
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
-
// with the GNU Classpath Exception which is available at
|
|
13
|
-
// https://www.gnu.org/software/classpath/license.html.
|
|
14
|
-
//
|
|
15
|
-
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
16
|
-
// *****************************************************************************
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
const tslib_1 = require("tslib");
|
|
19
|
-
(0, tslib_1.__exportStar)(require("./process-manager"), exports);
|
|
20
|
-
(0, tslib_1.__exportStar)(require("./process"), exports);
|
|
21
|
-
(0, tslib_1.__exportStar)(require("./raw-process"), exports);
|
|
22
|
-
(0, tslib_1.__exportStar)(require("./terminal-process"), exports);
|
|
23
|
-
(0, tslib_1.__exportStar)(require("./task-terminal-process"), exports);
|
|
24
|
-
(0, tslib_1.__exportStar)(require("./multi-ring-buffer"), exports);
|
|
1
|
+
"use strict";
|
|
2
|
+
// *****************************************************************************
|
|
3
|
+
// Copyright (C) 2017 Ericsson and others.
|
|
4
|
+
//
|
|
5
|
+
// This program and the accompanying materials are made available under the
|
|
6
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
+
//
|
|
9
|
+
// This Source Code may also be made available under the following Secondary
|
|
10
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
+
// with the GNU Classpath Exception which is available at
|
|
13
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
14
|
+
//
|
|
15
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
16
|
+
// *****************************************************************************
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
const tslib_1 = require("tslib");
|
|
19
|
+
(0, tslib_1.__exportStar)(require("./process-manager"), exports);
|
|
20
|
+
(0, tslib_1.__exportStar)(require("./process"), exports);
|
|
21
|
+
(0, tslib_1.__exportStar)(require("./raw-process"), exports);
|
|
22
|
+
(0, tslib_1.__exportStar)(require("./terminal-process"), exports);
|
|
23
|
+
(0, tslib_1.__exportStar)(require("./task-terminal-process"), exports);
|
|
24
|
+
(0, tslib_1.__exportStar)(require("./multi-ring-buffer"), exports);
|
|
25
25
|
//# sourceMappingURL=index.js.map
|