@auroraflow/code 0.0.12 → 0.0.14

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": "@auroraflow/code",
3
- "version": "0.0.12",
3
+ "version": "0.0.14",
4
4
  "type": "module",
5
5
  "description": "Aurora launcher and sidecar for official Codex and Claude Code clients.",
6
6
  "repository": {
@@ -211,10 +211,11 @@ function tomlString(value) {
211
211
  }
212
212
 
213
213
  async function spawnAndExit(command, args, env) {
214
- const child = spawn(command, args, {
214
+ const spec = windowsCommandSpec(command, args);
215
+ const child = spawn(spec.command, spec.args, {
215
216
  stdio: "inherit",
216
217
  env,
217
- shell: process.platform === "win32" && command.endsWith(".cmd")
218
+ shell: spec.shell
218
219
  });
219
220
  child.on("error", error => {
220
221
  console.error(`Failed to start ${command}: ${error.message}`);
@@ -225,11 +226,12 @@ async function spawnAndExit(command, args, env) {
225
226
 
226
227
  function spawnAndWait(command, args, env) {
227
228
  return new Promise((resolve, reject) => {
228
- const child = spawn(command, args, {
229
+ const spec = windowsCommandSpec(command, args);
230
+ const child = spawn(spec.command, spec.args, {
229
231
  cwd: packageRoot,
230
232
  stdio: "inherit",
231
233
  env,
232
- shell: process.platform === "win32"
234
+ shell: spec.shell
233
235
  });
234
236
  child.on("error", reject);
235
237
  child.on("exit", code => {
@@ -240,8 +242,23 @@ function spawnAndWait(command, args, env) {
240
242
  }
241
243
 
242
244
  function spawnSyncCompat(command, args) {
243
- return spawnSync(command, args, {
245
+ const spec = windowsCommandSpec(command, args);
246
+ return spawnSync(spec.command, spec.args, {
244
247
  encoding: "utf8",
245
- shell: process.platform === "win32" && command.endsWith(".cmd")
248
+ shell: spec.shell
246
249
  });
247
250
  }
251
+
252
+ function windowsCommandSpec(command, args) {
253
+ if (process.platform !== "win32" || !command.toLowerCase().endsWith(".cmd")) {
254
+ return { command, args, shell: false };
255
+ }
256
+ // Windows npm global bins are .cmd shims, commonly under "C:\Program Files".
257
+ // Invoke the batch file through cmd.exe + call so cmd receives the script
258
+ // path as an argv item instead of reparsing one pre-quoted command string.
259
+ return {
260
+ command: process.env.ComSpec || "cmd.exe",
261
+ args: ["/d", "/c", "call", command, ...args],
262
+ shell: false
263
+ };
264
+ }