|
3 | 3 | # file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
4 | 4 |
|
5 | 5 | import argparse
|
6 |
| -import sys |
7 |
| -from pathlib import Path |
8 | 6 |
|
9 | 7 | from mach.decorators import Command, CommandArgument
|
10 | 8 |
|
11 | 9 |
|
12 |
| -@Command("xpcshell", category="misc", description="Run the xpcshell binary") |
| 10 | +@Command( |
| 11 | + "xpcshell", |
| 12 | + category="misc", |
| 13 | + description="Run the xpcshell binary", |
| 14 | +) |
| 15 | +@CommandArgument( |
| 16 | + "--app", |
| 17 | + help="The path to the Firefox binary (default: the binary in $TOPOBJDIR)", |
| 18 | + dest="firefox_bin", |
| 19 | +) |
13 | 20 | @CommandArgument(
|
14 |
| - "args", nargs=argparse.REMAINDER, help="Arguments to provide to xpcshell" |
| 21 | + "args", |
| 22 | + nargs=argparse.REMAINDER, |
| 23 | + help="Arguments to provide to xpcshell", |
15 | 24 | )
|
16 |
| -def xpcshell(command_context, args): |
17 |
| - dist_bin = Path(command_context.topobjdir, "dist", "bin") |
18 |
| - browser_dir = dist_bin / "browser" |
19 |
| - |
20 |
| - if sys.platform == "win32": |
21 |
| - xpcshell = dist_bin / "xpcshell.exe" |
22 |
| - else: |
23 |
| - xpcshell = dist_bin / "xpcshell" |
24 |
| - |
25 |
| - command = [ |
26 |
| - str(xpcshell), |
27 |
| - "-g", |
28 |
| - str(dist_bin), |
29 |
| - "-a", |
30 |
| - str(browser_dir), |
31 |
| - ] |
| 25 | +def xpcshell(command_context, *, firefox_bin, args): |
| 26 | + if not firefox_bin: |
| 27 | + firefox_bin = command_context.get_binary_path("app") |
| 28 | + |
| 29 | + command = [str(firefox_bin), "-xpcshell"] |
32 | 30 |
|
33 | 31 | # Disable the socket process (see https://bugzilla.mozilla.org/show_bug.cgi?id=1903631).
|
34 | 32 | env = {
|
|
0 commit comments