Skip to content

Commit c5db475

Browse files
Lightning00BladeDevtools-frontend LUCI CQ
authored andcommitted
Fix passing command to sub-script
https://github.com/yargs/yargs-parser?tab=readme-ov-file#strip-aliased Bug: none Change-Id: Ifb1a77de162ea6367ed76d7e2f6f4301d4c9890d Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6396776 Commit-Queue: Nikolay Vitkov <[email protected]> Reviewed-by: Philip Pfaffe <[email protected]> Commit-Queue: Liviu Rau <[email protected]> Auto-Submit: Nikolay Vitkov <[email protected]> Reviewed-by: Liviu Rau <[email protected]>
1 parent 18a5140 commit c5db475

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

scripts/run_on_target.mjs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,18 @@ import yargs from 'yargs';
99
import unparse from 'yargs-unparser';
1010

1111
const argv = yargs(process.argv.slice(2))
12+
.parserConfiguration({
13+
'strip-aliased': true,
14+
})
1215
.command('$0 [script]')
1316
.option('target', { alias: 't', type: 'string', default: 'Default' })
1417
.help(false)
1518
.version(false)
1619
.parseSync();
1720

21+
delete argv.target;
22+
delete argv.script;
23+
1824
const target = argv.target;
1925
let script = argv.script;
2026
let sourceRoot = path.dirname(path.dirname(path.resolve(argv['$0'])));
@@ -75,7 +81,7 @@ if (!fs.existsSync(scriptPath)) {
7581
const { argv0 } = process;
7682
const { status } = childProcess.spawnSync(
7783
argv0,
78-
[scriptPath, ...unparse({ _: argv._ })],
84+
[scriptPath, ...unparse(argv)],
7985
{ stdio: 'inherit', env },
8086
);
8187
process.exit(status);

0 commit comments

Comments
 (0)