diff --git a/CHANGELOG.md b/CHANGELOG.md index 47ff150..6d9b058 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## [2.0.3] - 2024-11-23 +### Added +- Open in terminal bug fix for containers + ## [0.1.9] - 2024-10-20 ### Added - Added create volume tool diff --git a/package.json b/package.json index 0902dd6..8ab8d50 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "podmanager", "displayName": "Pod Manager", "description": "Manage Podman containers, images, volumes, and networks.", - "version": "2.0.2", + "version": "2.0.3", "publisher": "dreamcatcher45", "homepage": "https://pod-manager.pages.dev", "repository": { diff --git a/src/extension.ts b/src/extension.ts index e14861c..704fad4 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -219,8 +219,9 @@ async function restartContainer(item: PodmanItem) { async function openInTerminal(item: PodmanItem) { if (item.id) { try { + const containerId = extractContainerId(item.id); const terminal = vscode.window.createTerminal(`Podman: ${item.label}`); - terminal.sendText(`${getPodmanPath()} exec -it ${item.id} /bin/sh`); + terminal.sendText(`${getPodmanPath()} exec -it ${containerId} /bin/sh`); terminal.show(); } catch (error) { vscode.window.showErrorMessage(`Failed to open terminal for container ${item.id}: ${error}`); @@ -277,6 +278,16 @@ async function deleteNetwork(item: PodmanItem) { } } +function extractContainerId(fullId: string): string { + // If the ID contains a hyphen followed by a hash-like string at the end + const match = fullId.match(/-([a-f0-9]{12})$/i); + if (match) { + return match[1]; + } + // If no match found, return the original ID + return fullId; +} + async function checkPodmanMachineStatus(): Promise { try { const { stdout } = await execAsync(`${getPodmanPath()} machine list --format "{{.Name}}|{{.Running}}"`);