Skip to content

Conversation

@adrenjc
Copy link

@adrenjc adrenjc commented Jan 20, 2026

Summary

  • replace the POSIX shell wrapper with a Node-based wrapper so npm shims on Windows no longer require /bin/sh
  • fix the Windows .cmd wrapper to invoke the correct entry script
  • avoid DETACHED_PROCESS in headed mode on Windows so the browser window appears

Test plan

  • npm test

@vercel
Copy link
Contributor

vercel bot commented Jan 20, 2026

@adrenjc is attempting to deploy a commit to the Vercel Labs Team on Vercel.

A member of the Team first needs to authorize it.

Ensure Windows installs no longer rely on /bin/sh, fix the .cmd entrypoint, and allow headed mode to show the browser window.
Comment on lines +4 to +20
const [{ accessSync, constants, existsSync, realpathSync }, { spawn }, { dirname, join }] =
await Promise.all([import('fs'), import('child_process'), import('path')]);

const scriptArg = process.argv[1];
if (!scriptArg) {
console.error('Error: Missing script path for agent-browser wrapper');
process.exit(1);
}

let scriptPath;
try {
scriptPath = realpathSync(scriptArg);
} catch (err) {
const message = err instanceof Error ? err.message : String(err);
console.error(`Error: Failed to resolve script path: ${message}`);
process.exit(1);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const [{ accessSync, constants, existsSync, realpathSync }, { spawn }, { dirname, join }] =
await Promise.all([import('fs'), import('child_process'), import('path')]);
const scriptArg = process.argv[1];
if (!scriptArg) {
console.error('Error: Missing script path for agent-browser wrapper');
process.exit(1);
}
let scriptPath;
try {
scriptPath = realpathSync(scriptArg);
} catch (err) {
const message = err instanceof Error ? err.message : String(err);
console.error(`Error: Failed to resolve script path: ${message}`);
process.exit(1);
}
const [{ accessSync, constants, existsSync, realpathSync }, { spawn }, { dirname, join }, { fileURLToPath }] =
await Promise.all([import('fs'), import('child_process'), import('path'), import('url')]);
const scriptPath = realpathSync(fileURLToPath(import.meta.url));

process.argv[1] is unreliable for determining script path when invoked through npm shims, should use import.meta.url instead

Fix on Vercel

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant