diff --git a/python/mozbuild/mozbuild/mach_commands.py b/python/mozbuild/mozbuild/mach_commands.py index cfcc8f56afa..39c1753eb21 100644 --- a/python/mozbuild/mozbuild/mach_commands.py +++ b/python/mozbuild/mozbuild/mach_commands.py @@ -594,7 +594,9 @@ class RunProgram(MachCommandBase): help='Command-line arguments to pass to the program.') @CommandArgument('+remote', '+r', action='store_true', help='Do not pass the -no-remote argument by default.') - def run(self, params, remote): + @CommandArgument('+background', '+b', action='store_true', + help='Do not pass the -foreground argument by default on Mac') + def run(self, params, remote, background): try: args = [self.get_binary_path('app')] except Exception as e: @@ -604,6 +606,8 @@ class RunProgram(MachCommandBase): return 1 if not remote: args.append('-no-remote') + if not background and sys.platform == 'darwin': + args.append('-foreground') if params: args.extend(params) return self.run_process(args=args, ensure_exit_code=False, @@ -619,7 +623,9 @@ class DebugProgram(MachCommandBase): help='Command-line arguments to pass to the program.') @CommandArgument('+remote', '+r', action='store_true', help='Do not pass the -no-remote argument by default') - def debug(self, params, remote): + @CommandArgument('+background', '+b', action='store_true', + help='Do not pass the -foreground argument by default on Mac') + def debug(self, params, remote, background): import which try: debugger = which.which('gdb') @@ -636,6 +642,8 @@ class DebugProgram(MachCommandBase): return 1 if not remote: args.append('-no-remote') + if not background and sys.platform == 'darwin': + args.append('-foreground') if params: args.extend(params) return self.run_process(args=args, ensure_exit_code=False,