@kaitranntt/ccs 7.36.0-dev.5 → 7.36.0-dev.6
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.
|
@@ -5,8 +5,11 @@
|
|
|
5
5
|
*/
|
|
6
6
|
/// <reference types="node" />
|
|
7
7
|
/**
|
|
8
|
-
* Escape arguments for shell execution (
|
|
9
|
-
*
|
|
8
|
+
* Escape arguments for shell execution (cross-platform)
|
|
9
|
+
*
|
|
10
|
+
* IMPORTANT: On Windows, spawn({ shell: true }) uses cmd.exe by default,
|
|
11
|
+
* NOT PowerShell. cmd.exe does NOT recognize single quotes as string delimiters.
|
|
12
|
+
* We must use double quotes for cmd.exe compatibility.
|
|
10
13
|
*/
|
|
11
14
|
export declare function escapeShellArg(arg: string): string;
|
|
12
15
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shell-executor.d.ts","sourceRoot":"","sources":["../../src/utils/shell-executor.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;AAMH
|
|
1
|
+
{"version":3,"file":"shell-executor.d.ts","sourceRoot":"","sources":["../../src/utils/shell-executor.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;AAMH;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAqBlD;AAED;;GAEG;AACH,wBAAgB,UAAU,CACxB,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,MAAM,EAAE,EACd,OAAO,GAAE,MAAM,CAAC,UAAU,GAAG,IAAW,GACvC,IAAI,CAwCN"}
|
|
@@ -10,32 +10,30 @@ const child_process_1 = require("child_process");
|
|
|
10
10
|
const error_manager_1 = require("./error-manager");
|
|
11
11
|
const websearch_manager_1 = require("./websearch-manager");
|
|
12
12
|
/**
|
|
13
|
-
* Escape arguments for shell execution (
|
|
14
|
-
*
|
|
13
|
+
* Escape arguments for shell execution (cross-platform)
|
|
14
|
+
*
|
|
15
|
+
* IMPORTANT: On Windows, spawn({ shell: true }) uses cmd.exe by default,
|
|
16
|
+
* NOT PowerShell. cmd.exe does NOT recognize single quotes as string delimiters.
|
|
17
|
+
* We must use double quotes for cmd.exe compatibility.
|
|
15
18
|
*/
|
|
16
19
|
function escapeShellArg(arg) {
|
|
17
20
|
const isWindows = process.platform === 'win32';
|
|
18
21
|
if (isWindows) {
|
|
19
|
-
//
|
|
20
|
-
//
|
|
21
|
-
//
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}
|
|
31
|
-
else {
|
|
32
|
-
// No single quotes - use single quotes for literal string (safest)
|
|
33
|
-
return "'" + String(arg) + "'";
|
|
34
|
-
}
|
|
22
|
+
// cmd.exe: Use double quotes, escape inner double quotes by doubling them
|
|
23
|
+
// cmd.exe interprets "" as escaped double quote inside quoted string
|
|
24
|
+
// Strip newlines/tabs that can break cmd.exe parsing
|
|
25
|
+
return ('"' +
|
|
26
|
+
String(arg)
|
|
27
|
+
.replace(/[\r\n\t]/g, ' ') // Replace newlines/tabs with space
|
|
28
|
+
.replace(/%/g, '%%') // Escape percent signs
|
|
29
|
+
.replace(/\^/g, '^^') // Escape carets
|
|
30
|
+
.replace(/!/g, '^^!') // Escape exclamation marks (delayed expansion)
|
|
31
|
+
.replace(/"/g, '""') + // Escape quotes
|
|
32
|
+
'"');
|
|
35
33
|
}
|
|
36
34
|
else {
|
|
37
35
|
// Unix/macOS: Double quotes with escaped inner quotes
|
|
38
|
-
return '"' + String(arg).replace(/"/g, '"
|
|
36
|
+
return '"' + String(arg).replace(/"/g, '\\"') + '"';
|
|
39
37
|
}
|
|
40
38
|
}
|
|
41
39
|
exports.escapeShellArg = escapeShellArg;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shell-executor.js","sourceRoot":"","sources":["../../src/utils/shell-executor.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH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