@solidstarters/solid-core 1.2.207 → 1.2.208

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solidstarters/solid-core",
3
- "version": "1.2.207",
3
+ "version": "1.2.208",
4
4
  "description": "This module is a NestJS module containing all the required core providers required by a Solid application",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -10,6 +10,21 @@ export type CommandWithArgs = {
10
10
  export class CommandService {
11
11
  private readonly logger = new Logger(CommandService.name);
12
12
 
13
+ /**
14
+ * Escape an argument for Windows CMD shell
15
+ * Wraps in double quotes and escapes internal double quotes
16
+ */
17
+ private escapeArgForWindows(arg: string): string {
18
+ // If arg contains special characters, wrap in double quotes
19
+ // and escape internal double quotes with backslash
20
+ if (/[{}\s"^&|<>]/.test(arg)) {
21
+ // Escape internal double quotes with backslash for CMD
22
+ const escaped = arg.replace(/"/g, '\\"');
23
+ return `"${escaped}"`;
24
+ }
25
+ return arg;
26
+ }
27
+
13
28
  /**
14
29
  * Execute a command with arguments array (cross-platform compatible)
15
30
  */
@@ -20,11 +35,12 @@ export class CommandService {
20
35
  return new Promise<string>((resolve, reject) => {
21
36
  const isWindows = process.platform === 'win32';
22
37
 
23
- // On Windows, we need to use cmd /c for commands that might be .cmd files (like npm scripts)
24
- const spawnCommand = isWindows ? command : command;
25
- const spawnArgs = args;
38
+ // On Windows with shell: true, we need to escape args containing special characters
39
+ const spawnArgs = isWindows
40
+ ? args.map(arg => this.escapeArgForWindows(arg))
41
+ : args;
26
42
 
27
- const child = spawn(spawnCommand, spawnArgs, {
43
+ const child = spawn(command, spawnArgs, {
28
44
  shell: isWindows, // Use shell on Windows to handle .cmd files
29
45
  stdio: ['pipe', 'pipe', 'pipe'],
30
46
  });