mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00:00
fix: quote path to prevent space issue (#11733)
Co-authored-by: Xiaoxing Ye <xiaoye@microsoft.com>
This commit is contained in:
parent
5635e840f8
commit
a35c249fdc
@ -647,7 +647,7 @@ export class Registry {
|
||||
if (code !== 0)
|
||||
throw new Error(`Failed to install ${channel}`);
|
||||
} else {
|
||||
const { command, args, elevatedPermissions } = await transformCommandsForRoot([`bash ${path.join(BIN_PATH, scriptName)} ${scriptArgs.join('')}`]);
|
||||
const { command, args, elevatedPermissions } = await transformCommandsForRoot([`bash "${path.join(BIN_PATH, scriptName)}" ${scriptArgs.join('')}`]);
|
||||
if (elevatedPermissions)
|
||||
console.log('Switching to root user to install dependencies...'); // eslint-disable-line no-console
|
||||
const { code } = await spawnAsync(command, args, { cwd, stdio: 'inherit' });
|
||||
|
||||
@ -62,13 +62,21 @@ const lintMode = process.argv.slice(2).includes('--lint');
|
||||
const ROOT = path.join(__dirname, '..', '..');
|
||||
|
||||
/**
|
||||
* @param {string} relative
|
||||
* @param {string} relative
|
||||
* @returns {string}
|
||||
*/
|
||||
function filePath(relative) {
|
||||
return path.join(ROOT, ...relative.split('/'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} path
|
||||
* @returns {string}
|
||||
*/
|
||||
function quotePath(path) {
|
||||
return "\"" + path + "\"";
|
||||
}
|
||||
|
||||
async function runWatch() {
|
||||
function runOnChanges(paths, mustExist = [], nodeFile) {
|
||||
nodeFile = filePath(nodeFile);
|
||||
@ -108,7 +116,7 @@ async function runWatch() {
|
||||
|
||||
async function runBuild() {
|
||||
/**
|
||||
* @param {Step} step
|
||||
* @param {Step} step
|
||||
*/
|
||||
function runStep(step) {
|
||||
const out = child_process.spawnSync(step.command, step.args, {
|
||||
@ -143,9 +151,9 @@ async function runBuild() {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} file
|
||||
* @param {string} from
|
||||
* @param {string} to
|
||||
* @param {string} file
|
||||
* @param {string} from
|
||||
* @param {string} to
|
||||
*/
|
||||
function copyFile(file, from, to) {
|
||||
const destination = path.resolve(filePath(to), path.relative(filePath(from), file));
|
||||
@ -172,7 +180,7 @@ const webPackFiles = [
|
||||
for (const file of webPackFiles) {
|
||||
steps.push({
|
||||
command: 'npx',
|
||||
args: ['webpack', '--config', filePath(file), ...(watchMode ? ['--watch', '--stats', 'none'] : [])],
|
||||
args: ['webpack', '--config', quotePath(filePath(file)), ...(watchMode ? ['--watch', '--stats', 'none'] : [])],
|
||||
shell: true,
|
||||
env: {
|
||||
NODE_ENV: watchMode ? 'development' : 'production'
|
||||
@ -190,9 +198,9 @@ for (const packageDir of packages) {
|
||||
'babel',
|
||||
...(watchMode ? ['-w', '--source-maps'] : []),
|
||||
'--extensions', '.ts',
|
||||
'--out-dir', path.join(packageDir, 'lib'),
|
||||
'--out-dir', quotePath(path.join(packageDir, 'lib')),
|
||||
'--ignore', '"packages/playwright-core/src/server/injected/**/*"',
|
||||
path.join(packageDir, 'src')],
|
||||
quotePath(path.join(packageDir, 'src'))],
|
||||
shell: true,
|
||||
});
|
||||
}
|
||||
@ -263,7 +271,7 @@ if (lintMode) {
|
||||
// Run TypeScript for type chekcing.
|
||||
steps.push({
|
||||
command: 'npx',
|
||||
args: ['tsc', ...(watchMode ? ['-w'] : []), '-p', filePath('.')],
|
||||
args: ['tsc', ...(watchMode ? ['-w'] : []), '-p', quotePath(filePath('.'))],
|
||||
shell: true,
|
||||
});
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user