@wyxos/zephyr 0.2.11 → 0.2.13

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.
@@ -27,16 +27,30 @@ function logWarning(message) {
27
27
 
28
28
  function runCommand(command, args, { cwd = process.cwd(), capture = false, useShell = false } = {}) {
29
29
  return new Promise((resolve, reject) => {
30
+ const needsShell = useShell || (IS_WINDOWS && (command === 'php' || command === 'composer'))
31
+
30
32
  const spawnOptions = {
31
33
  cwd,
32
34
  stdio: capture ? ['ignore', 'pipe', 'pipe'] : 'inherit'
33
35
  }
34
36
 
35
- if (useShell || (IS_WINDOWS && (command === 'php' || command === 'composer'))) {
37
+ let child
38
+ if (needsShell) {
39
+ // When using shell, construct the command string to avoid deprecation warning
40
+ // Properly escape arguments for Windows cmd.exe
41
+ const escapedArgs = args.map(arg => {
42
+ // If arg contains spaces or special chars, wrap in quotes and escape internal quotes
43
+ if (arg.includes(' ') || arg.includes('"') || arg.includes('&') || arg.includes('|')) {
44
+ return `"${arg.replace(/"/g, '\\"')}"`
45
+ }
46
+ return arg
47
+ })
48
+ const commandString = `${command} ${escapedArgs.join(' ')}`
36
49
  spawnOptions.shell = true
50
+ child = spawn(commandString, [], spawnOptions)
51
+ } else {
52
+ child = spawn(command, args, spawnOptions)
37
53
  }
38
-
39
- const child = spawn(command, args, spawnOptions)
40
54
  let stdout = ''
41
55
  let stderr = ''
42
56
 
package/src/ssh-utils.mjs CHANGED
@@ -275,3 +275,4 @@ export async function deleteRemoteFile(ssh, remotePath, remoteCwd) {
275
275
  logSuccess(`Deleted remote file: ${absoluteRemotePath}`)
276
276
  }
277
277
  }
278
+