diff --git a/src/plugins/ssh/index.ts b/src/plugins/ssh/index.ts index a231892..d84ddbd 100644 --- a/src/plugins/ssh/index.ts +++ b/src/plugins/ssh/index.ts @@ -116,11 +116,6 @@ type SpawnSshNodeOptions = { isAccessPropagationPreTest?: boolean; }; -/** Starts an SSM session in the terminal by spawning `aws ssm` as a subprocess - * - * Requires `aws ssm` to be installed on the client machine. - */ - async function spawnSshNode( options: SpawnSshNodeOptions ): Promise { @@ -183,7 +178,15 @@ async function spawnSshNode( } options.abortController?.abort(code); - if (!options.isAccessPropagationPreTest) print2(`SSH session terminated`); + + if (code && code !== 0) { + print2( + `Failed to establish an SSH session.${!options.debug ? " Use the --debug option to see additional details." : ""}` + ); + } else if (!options.isAccessPropagationPreTest) { + print2(`SSH session terminated`); + } + resolve(code); }); }); @@ -386,8 +389,10 @@ export const sshOrScp = async (args: { proxyCommand, credential ); + + // Only exit if there was an error when pre-testing if (exitCode && exitCode !== 0) { - return exitCode; // Only exit if there was an error when pre-testing + return exitCode; } return spawnSshNode({