fix: resolve browser tool syntax errors using robust base64 write-and-run pattern
This commit is contained in:
@@ -35,8 +35,11 @@ const { chromium } = require('playwright');
|
||||
})();
|
||||
`;
|
||||
|
||||
// We need to ensure playwright is installed and the browsers are downloaded.
|
||||
const setupCmd = `if [ ! -d "node_modules/playwright" ]; then npm install --no-save playwright && npx playwright install chromium; fi && node -e "${script.replace(/"/g, '\\"').replace(/\$/g, "\\$")}"`;
|
||||
// Encode the script to base64 to bypass any shell quoting/escaping conflicts
|
||||
const scriptB64 = Buffer.from(script, "utf8").toString("base64");
|
||||
const tempFile = `.vibn-console-${projectId}.js`;
|
||||
|
||||
const setupCmd = `echo "${scriptB64}" | base64 -d > ${tempFile} && if [ ! -d "node_modules/playwright" ]; then npm install --no-save playwright && npx playwright install chromium; fi && node ${tempFile} && rm -f ${tempFile}`;
|
||||
|
||||
try {
|
||||
const res = await execInDevContainer({
|
||||
@@ -99,7 +102,11 @@ const { chromium } = require('playwright');
|
||||
})();
|
||||
`;
|
||||
|
||||
const setupCmd = `if [ ! -d "node_modules/playwright" ]; then npm install --no-save playwright && npx playwright install chromium; fi && node -e "${script.replace(/"/g, '\\"').replace(/\$/g, "\\$")}"`;
|
||||
// Encode the script to base64 to bypass any shell quoting/escaping conflicts
|
||||
const scriptB64 = Buffer.from(script, "utf8").toString("base64");
|
||||
const tempFile = `.vibn-navigate-${projectId}.js`;
|
||||
|
||||
const setupCmd = `echo "${scriptB64}" | base64 -d > ${tempFile} && if [ ! -d "node_modules/playwright" ]; then npm install --no-save playwright && npx playwright install chromium; fi && node ${tempFile} && rm -f ${tempFile}`;
|
||||
|
||||
try {
|
||||
const res = await execInDevContainer({
|
||||
|
||||
Reference in New Issue
Block a user