diff --git a/eden/fs/cli/rage.py b/eden/fs/cli/rage.py index 18eb76a850ff8..f3ca0c43bc373 100644 --- a/eden/fs/cli/rage.py +++ b/eden/fs/cli/rage.py @@ -35,7 +35,12 @@ from .config import EdenInstance try: - from .facebook.rage import find_fb_cdb, get_host_dashboard_url, setup_fb_env + from .facebook.rage import ( + find_fb_cdb, + get_host_dashboard_url, + get_quickstack_cmd, + setup_fb_env, + ) except ImportError: @@ -50,6 +55,11 @@ def get_host_dashboard_url( ) -> Optional[str]: return None + def get_quickstack_cmd( + instance: EdenInstance, + ) -> Optional[List[str]]: + return None + try: from eden.fs.cli.doctor.facebook.check_vscode_extensions import ( @@ -314,6 +324,17 @@ def print_diagnostic_info( print_system_load(out) + quickstack_cmd = get_quickstack_cmd(instance) + + if quickstack_cmd: + section_title("Quickstack:", out) + paste_output( + lambda sink: run_cmd(quickstack_cmd, sink, out), + processor, + out, + dry_run, + ) + print_ulimits(out) @@ -614,8 +635,17 @@ def print_system_load(out: IO[bytes]) -> None: out.write(f"Error printing system load: {e}\n".encode()) -def run_edenfsctl_cmd(cmd: List[str], sink: IO[bytes]) -> None: - subprocess.run(cmd, check=True, stderr=subprocess.STDOUT, stdout=sink) +def run_cmd( + cmd: List[str], sink: IO[bytes], out: IO[bytes], timeout: float = 10 +) -> None: + try: + subprocess.run( + cmd, check=True, stderr=subprocess.STDOUT, stdout=sink, timeout=timeout + ) + except subprocess.TimeoutExpired: + out.write( + f"Command {' '.join(cmd)} timed out after {timeout} seconds\n".encode() + ) def print_eden_config( @@ -625,7 +655,7 @@ def print_eden_config( fsconfig_cmd = ["edenfsctl", "fsconfig", "--all"] result = paste_output( - lambda sink: run_edenfsctl_cmd(fsconfig_cmd, sink), + lambda sink: run_cmd(fsconfig_cmd, sink, out), processor, out, dry_run, @@ -740,7 +770,7 @@ def print_recent_events(processor: str, out: IO[bytes], dry_run: bool) -> None: try: out.write(f"{opt}: ".encode()) paste_output( - lambda sink: run_edenfsctl_cmd(trace_cmd, sink), + lambda sink, trace_cmd=trace_cmd: run_cmd(trace_cmd, sink, out), processor, out, dry_run,