mirror of
https://github.com/balena-io/balena-cli.git
synced 2024-12-22 06:57:48 +00:00
Fix windows straight-to-container SSH
Closes: #1211 Change-type: patch Signed-off-by: Cameron Diver <cameron@balena.io>
This commit is contained in:
parent
64c2f00d2a
commit
94c9e13106
@ -32,6 +32,7 @@ export async function performLocalDeviceSSH(
|
|||||||
const { getSubShellCommand } = await import('../helpers');
|
const { getSubShellCommand } = await import('../helpers');
|
||||||
const { exitWithExpectedError } = await import('../patterns');
|
const { exitWithExpectedError } = await import('../patterns');
|
||||||
const { stripIndent } = await import('common-tags');
|
const { stripIndent } = await import('common-tags');
|
||||||
|
const os = await import('os');
|
||||||
|
|
||||||
let command = '';
|
let command = '';
|
||||||
|
|
||||||
@ -98,11 +99,20 @@ export async function performLocalDeviceSSH(
|
|||||||
`);
|
`);
|
||||||
}
|
}
|
||||||
|
|
||||||
const shellCmd = `/bin/sh -c $"'if [ -e /bin/bash ]; then exec /bin/bash; else exec /bin/sh; fi'"`;
|
// Getting a command to work on all platforms is a pain,
|
||||||
|
// so we just define slightly different ones for windows
|
||||||
|
if (os.platform() !== 'win32') {
|
||||||
|
const shellCmd = `/bin/sh -c "if [ -e /bin/bash ]; then exec /bin/bash; else exec /bin/sh; fi"`;
|
||||||
command = `'${deviceContainerEngineBinary}' exec -ti ${
|
command = `'${deviceContainerEngineBinary}' exec -ti ${
|
||||||
containers[0]!.id
|
containers[0]!.id
|
||||||
|
} '${shellCmd}'`;
|
||||||
|
} else {
|
||||||
|
const shellCmd = `/bin/sh -c "if [ -e /bin/bash ]; then exec /bin/bash; else exec /bin/sh; fi"`;
|
||||||
|
command = `${deviceContainerEngineBinary} exec -ti ${
|
||||||
|
containers[0]!.id
|
||||||
} ${shellCmd}`;
|
} ${shellCmd}`;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// Generate the SSH command
|
// Generate the SSH command
|
||||||
const sshCommand = `ssh \
|
const sshCommand = `ssh \
|
||||||
${opts.verbose ? '-vvv' : ''} \
|
${opts.verbose ? '-vvv' : ''} \
|
||||||
|
Loading…
Reference in New Issue
Block a user