跳到主要内容

接口: ProviderConnectionShellAccess

打开Shell会话的回调

方法

open()

open(): ProviderConnectionShellAccessSession

使用 ProviderConnectionShellAccessImpl 类打开新会话

返回

提供者连接Shell访问会话

示例

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);
}

定义于

packages/extension-api/src/extension-api.d.ts:833