接口: ProviderConnectionShellAccess
打开Shell会话的回调
方法
open()
使用 ProviderConnectionShellAccessImpl 类打开新会话
返回
示例
import * as api from '@podman-desktop/api';
class ProviderConnectionShellAccessImpl implements ProviderConnectionShellAccess {
open(): ProviderConnectionShellAccessSession {
// This is client that will connect to your shell
#client = new Client();
// You need to listen to events from client and forward them to the caller by using the object returned below
return {
onData,
onError,
onEnd,
write,
resize,
close,
};
}
}
export async function activate(extensionContext: api.ExtensionContext): Promise<void> {
const providerConnectionShellAccess = new ProviderConnectionShellAccessImpl(machineInfo);
// Create containerProviderConnection object
const containerProviderConnection: extensionApi.ContainerProviderConnection = {
...
shellAccess: providerConnectionShellAccess,
...
};
const disposable = provider.registerContainerProviderConnection(containerProviderConnection);
extensionContext.subscriptions.push(disposable);
}