Interface: ExtensionHost

since 0.2.0



Readonly cli: ExtensionCli

Executes a command in the host.

For example, execute the shipped binary kubectl -h command in the host:

await"kubectl", ["-h"]);

Streams the output of the command executed in the backend container or in the host.

Provided the kubectl binary is shipped as part of your extension, you can spawn the kubectl -h command in the host:

await"kubectl", ["-h"], {
           stream: {
             onOutput(data): void {
                 // As we can receive both `stdout` and `stderr`, we wrap them in a JSON object
                     stdout: data.stdout,
                     stderr: data.stderr,
                   "  "
             onError(error: any): void {
             onClose(exitCode: number): void {
               console.log("onClose with exit code " + exitCode);
Docker, extensions, sdk, API, reference