Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cli: improve output for code tunnel status #183571

Merged
merged 2 commits into from May 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 14 additions & 6 deletions cli/src/commands/tunnels.rs
Expand Up @@ -35,7 +35,7 @@ use crate::{
},
util::{
app_lock::AppMutex,
errors::{wrap, AnyError},
errors::{wrap, AnyError, CodeError},
prereqs::PreReqChecker,
},
};
Expand Down Expand Up @@ -247,17 +247,25 @@ pub async fn kill(ctx: CommandContext) -> Result<i32, AnyError> {
}

pub async fn status(ctx: CommandContext) -> Result<i32, AnyError> {
let status: protocol::singleton::Status = do_single_rpc_call(
let status = do_single_rpc_call::<_, protocol::singleton::Status>(
&ctx.paths.tunnel_lockfile(),
ctx.log.clone(),
protocol::singleton::METHOD_STATUS,
protocol::EmptyObject {},
)
.await?;

ctx.log.result(serde_json::to_string(&status).unwrap());
.await;

Ok(0)
match status {
Err(CodeError::NoRunningTunnel) => {
ctx.log.result(CodeError::NoRunningTunnel.to_string());
Ok(1)
}
Err(e) => Err(e.into()),
Ok(s) => {
ctx.log.result(serde_json::to_string(&s).unwrap());
Ok(0)
}
}
}

/// Removes unused servers.
Expand Down
8 changes: 5 additions & 3 deletions src/vs/workbench/api/common/extHostTesting.ts
Expand Up @@ -138,10 +138,12 @@ export class ExtHostTesting implements ExtHostTestingShape {
createTestRun: (request, name, persist = true) => {
return this.runTracker.createTestRun(controllerId, collection, request, name, persist);
},
invalidateTestResults: item => {
invalidateTestResults: items => {
checkProposedApiEnabled(extension, 'testInvalidateResults');
const id = item ? TestId.fromExtHostTestItem(item, controllerId).toString() : controllerId;
return this.proxy.$markTestRetired(id);
for (const item of items instanceof Array ? items : [items]) {
const id = item ? TestId.fromExtHostTestItem(item, controllerId).toString() : controllerId;
this.proxy.$markTestRetired(id);
}
},
set resolveHandler(fn) {
collection.resolveHandler = fn;
Expand Down
2 changes: 1 addition & 1 deletion src/vscode-dts/vscode.proposed.testInvalidateResults.d.ts
Expand Up @@ -25,6 +25,6 @@ declare module 'vscode' {
*
* @param item Item to mark as outdated. If undefined, all the controller's items are marked outdated.
*/
invalidateTestResults(item?: TestItem): void;
invalidateTestResults(items?: TestItem | readonly TestItem[]): void;
}
}