Skip to content

Commit

Permalink
Troubleshoot by killing debugging bridge
Browse files Browse the repository at this point in the history
Summary: Add an option to kill the debugging bridge directly within Flipper.

Reviewed By: antonk52

Differential Revision: D47990786

fbshipit-source-id: 30cd8ca1d55e8b2ade03700d884e5d849a2dadbf
  • Loading branch information
lblasa authored and facebook-github-bot committed Aug 2, 2023
1 parent 4e998ac commit 5debb4c
Showing 1 changed file with 34 additions and 1 deletion.
35 changes: 34 additions & 1 deletion desktop/flipper-ui-core/src/chrome/ConnectivityLogs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,12 @@ import {CloseCircleFilled, DeleteOutlined} from '@ant-design/icons';
import {
CommandRecordEntry,
ConnectionRecordEntry,
DeviceOS,
FlipperServer,
FlipperServerCommands,
} from 'flipper-common';
import {Button} from 'antd';
import {getRenderHostInstance} from 'flipper-frontend-core';

const SIDEBAR_WIDTH = 400;

Expand Down Expand Up @@ -149,6 +152,35 @@ function isShellCommand(
return 'cmd' in entry;
}

function KillDebuggingBridge({os}: {os: DeviceOS}) {
const {
title,
cmd,
}: {
title: string;
cmd: keyof FlipperServerCommands;
} =
os === 'iOS'
? {title: 'Kill idb', cmd: 'ios-idb-kill'}
: {title: 'Kill adb server', cmd: 'android-adb-kill'};

return (
<>
<p>
Sometimes the error can be resolved by killing the {os} debugging
bridge.
</p>
<Button
type="default"
onClick={() => {
getRenderHostInstance().flipperServer.exec(cmd);
}}>
{title}
</Button>
</>
);
}

function Sidebar({selection}: {selection: undefined | ConnectionRecordEntry}) {
const content: JSX.Element[] = [];

Expand All @@ -168,7 +200,8 @@ function Sidebar({selection}: {selection: undefined | ConnectionRecordEntry}) {
<PanelContainer>{selection.stderr}</PanelContainer>
</Panel>,
<Panel key="troubleshoot" heading="Troubleshooting Tips">
{selection.troubleshoot}
<p>{selection.troubleshoot}</p>
{!selection.success && <KillDebuggingBridge os={selection.os} />}
</Panel>,
);
}
Expand Down

0 comments on commit 5debb4c

Please sign in to comment.