diff --git a/python/mozbuild/mozbuild/mach_commands.py b/python/mozbuild/mozbuild/mach_commands.py index 73b283fc92da..810089cf2d3d 100644 --- a/python/mozbuild/mozbuild/mach_commands.py +++ b/python/mozbuild/mozbuild/mach_commands.py @@ -338,6 +338,26 @@ class Install(MachCommandBase): def install(self): return self._run_make(directory=".", target='install', ensure_exit_code=False) +@CommandProvider +class RunProgram(MachCommandBase): + """Launch the compiled binary""" + + @Command('run', help='Run the compiled program.', prefix_chars='+') + @CommandArgument('params', default=None, nargs='*', + help='Command-line arguments to pass to the program.') + def run(self, params): + try: + args = [self.get_binary_path('app')] + except Exception as e: + print("It looks like your program isn't built.", + "You can run |mach build| to build it.") + print(e) + return 1 + if params: + args.extend(params) + return self.run_process(args=args, ensure_exit_code=False, + pass_thru=True) + @CommandProvider class Buildsymbols(MachCommandBase): """Produce a package of debug symbols suitable for use with Breakpad."""