Skip to content

Commit b35d64b

Browse files
Fredrik Folkessonchrisdias
authored andcommitted
Make the shell attach command customizable (#160)
* makes the shell attach command customizable * added 'shell' to the command name * fixed an error with fetching the settings
1 parent c8ca414 commit b35d64b

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

commands/open-shell-container.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@ import { ContainerNode } from '../explorer/models/containerNode';
55
import { reporter } from '../telemetry/telemetry';
66
const teleCmdId: string = 'vscode-docker.container.open-shell';
77

8+
const configOptions: vscode.WorkspaceConfiguration = vscode.workspace.getConfiguration('docker');
89
const engineTypeShellCommands = {
9-
[DockerEngineType.Linux]: "/bin/sh",
10-
[DockerEngineType.Windows]: "powershell"
10+
[DockerEngineType.Linux]: configOptions.get('attachShellCommand.linuxContainer', '/bin/sh'),
11+
[DockerEngineType.Windows]: configOptions.get('attachShellCommand.windowsContainer', 'powershell')
1112
}
1213

1314
export async function openShellContainer(context?: ContainerNode) {

package.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,16 @@
352352
"error"
353353
],
354354
"description": "Controls the diagnostic severity for flagging a Dockerfile with multiple HEALTHCHECK instructions."
355+
},
356+
"docker.attachShellCommand.linuxContainer": {
357+
"type": "string",
358+
"default": "/bin/sh",
359+
"description": "Attach command to use for Linux containers"
360+
},
361+
"docker.attachShellCommand.windowsContainer": {
362+
"type": "string",
363+
"default": "powershell",
364+
"description": "Attach command to use for Windows containers"
355365
}
356366
}
357367
},

0 commit comments

Comments
 (0)