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,10 +99,19 @@ 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,
|
||||||
command = `'${deviceContainerEngineBinary}' exec -ti ${
|
// so we just define slightly different ones for windows
|
||||||
containers[0]!.id
|
if (os.platform() !== 'win32') {
|
||||||
} ${shellCmd}`;
|
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}'`;
|
||||||
|
} 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}`;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Generate the SSH command
|
// Generate the SSH command
|
||||||
const sshCommand = `ssh \
|
const sshCommand = `ssh \
|
||||||
|
Loading…
Reference in New Issue
Block a user