Attach to a target and return the session ID for subsequent commands.
(&mut self, target_id: &str)
| 711 | |
| 712 | /// Attach to a target and return the session ID for subsequent commands. |
| 713 | pub async fn attach_to_target(&mut self, target_id: &str) -> Result<String> { |
| 714 | let result = self |
| 715 | .send( |
| 716 | "Target.attachToTarget", |
| 717 | json!({"targetId": target_id, "flatten": true}), |
| 718 | ) |
| 719 | .await?; |
| 720 | result["sessionId"] |
| 721 | .as_str() |
| 722 | .map(|s| s.to_string()) |
| 723 | .ok_or_else(|| anyhow!("No sessionId in attachToTarget response")) |
| 724 | } |
| 725 | |
| 726 | /// Detach from a target session. |
| 727 | pub async fn detach_from_target(&mut self, session_id: &str) -> Result<()> { |
no test coverage detected