diff --git a/CHANGELOG.md b/CHANGELOG.md index 139754d..cb5201f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ ### Fixes - Fix remote `code` command (#267) not working without the filesystem already connected (#292) - Fix bug with broken connections when connections are initiated by spawning named terminals +- Fix issue where `.bashrc` echoing would result in home directory detection failing (#294) ### Changes - Proxy hop field now actually lists all known configs to pick from, instead of "TO DO" (#290) diff --git a/src/connection.ts b/src/connection.ts index fbfc603..6a52090 100644 --- a/src/connection.ts +++ b/src/connection.ts @@ -22,14 +22,12 @@ export interface Connection { } async function tryGetHome(ssh: Client): Promise { - const exec = await toPromise(cb => ssh.exec('echo Home: ~', cb)); + const exec = await toPromise(cb => ssh.exec('echo "::sshfs:home:$(echo ~)\n"', cb)); let home = ''; exec.stdout.on('data', (chunk: any) => home += chunk); await toPromise(cb => exec.on('close', cb)); if (!home) return null; - const mat = home.match(/^Home: (.*?)\r?\n?$/); - if (!mat) return null; - return mat[1]; + return home.match(/::sshfs:home:(.*?)\n/)?.[1] || null; } const TMP_PROFILE_SCRIPT = `