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)
|
if (code !== 0)
|
||||||
throw new Error(`Failed to install ${channel}`);
|
throw new Error(`Failed to install ${channel}`);
|
||||||
} else {
|
} 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)
|
if (elevatedPermissions)
|
||||||
console.log('Switching to root user to install dependencies...'); // eslint-disable-line no-console
|
console.log('Switching to root user to install dependencies...'); // eslint-disable-line no-console
|
||||||
const { code } = await spawnAsync(command, args, { cwd, stdio: 'inherit' });
|
const { code } = await spawnAsync(command, args, { cwd, stdio: 'inherit' });
|
||||||
|
|
|
||||||
|
|
@ -69,6 +69,14 @@ function filePath(relative) {
|
||||||
return path.join(ROOT, ...relative.split('/'));
|
return path.join(ROOT, ...relative.split('/'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {string} path
|
||||||
|
* @returns {string}
|
||||||
|
*/
|
||||||
|
function quotePath(path) {
|
||||||
|
return "\"" + path + "\"";
|
||||||
|
}
|
||||||
|
|
||||||
async function runWatch() {
|
async function runWatch() {
|
||||||
function runOnChanges(paths, mustExist = [], nodeFile) {
|
function runOnChanges(paths, mustExist = [], nodeFile) {
|
||||||
nodeFile = filePath(nodeFile);
|
nodeFile = filePath(nodeFile);
|
||||||
|
|
@ -172,7 +180,7 @@ const webPackFiles = [
|
||||||
for (const file of webPackFiles) {
|
for (const file of webPackFiles) {
|
||||||
steps.push({
|
steps.push({
|
||||||
command: 'npx',
|
command: 'npx',
|
||||||
args: ['webpack', '--config', filePath(file), ...(watchMode ? ['--watch', '--stats', 'none'] : [])],
|
args: ['webpack', '--config', quotePath(filePath(file)), ...(watchMode ? ['--watch', '--stats', 'none'] : [])],
|
||||||
shell: true,
|
shell: true,
|
||||||
env: {
|
env: {
|
||||||
NODE_ENV: watchMode ? 'development' : 'production'
|
NODE_ENV: watchMode ? 'development' : 'production'
|
||||||
|
|
@ -190,9 +198,9 @@ for (const packageDir of packages) {
|
||||||
'babel',
|
'babel',
|
||||||
...(watchMode ? ['-w', '--source-maps'] : []),
|
...(watchMode ? ['-w', '--source-maps'] : []),
|
||||||
'--extensions', '.ts',
|
'--extensions', '.ts',
|
||||||
'--out-dir', path.join(packageDir, 'lib'),
|
'--out-dir', quotePath(path.join(packageDir, 'lib')),
|
||||||
'--ignore', '"packages/playwright-core/src/server/injected/**/*"',
|
'--ignore', '"packages/playwright-core/src/server/injected/**/*"',
|
||||||
path.join(packageDir, 'src')],
|
quotePath(path.join(packageDir, 'src'))],
|
||||||
shell: true,
|
shell: true,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -263,7 +271,7 @@ if (lintMode) {
|
||||||
// Run TypeScript for type chekcing.
|
// Run TypeScript for type chekcing.
|
||||||
steps.push({
|
steps.push({
|
||||||
command: 'npx',
|
command: 'npx',
|
||||||
args: ['tsc', ...(watchMode ? ['-w'] : []), '-p', filePath('.')],
|
args: ['tsc', ...(watchMode ? ['-w'] : []), '-p', quotePath(filePath('.'))],
|
||||||
shell: true,
|
shell: true,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue