From ed26e245e6b5f1a4ab717969a743936715ff201e Mon Sep 17 00:00:00 2001 From: Sebastian Malton Date: Tue, 20 Dec 2022 05:33:48 -0800 Subject: [PATCH] Prevent shell sync commands from polluting history (#6668) * Prevent shell sync commands from polluting history Signed-off-by: Sebastian Malton * Fix tests Signed-off-by: Sebastian Malton Signed-off-by: Sebastian Malton --- .../main/compute-unix-shell-environment.injectable.ts | 1 + .../shell-sync/main/compute-unix-shell-environment.test.ts | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/features/shell-sync/main/compute-unix-shell-environment.injectable.ts b/src/features/shell-sync/main/compute-unix-shell-environment.injectable.ts index e0f2b2aeb1..fa6de94b57 100644 --- a/src/features/shell-sync/main/compute-unix-shell-environment.injectable.ts +++ b/src/features/shell-sync/main/compute-unix-shell-environment.injectable.ts @@ -84,6 +84,7 @@ const computeUnixShellEnvironmentInjectable = getInjectable({ } else if (!cshLikeShellName.test(shellName)) { // zsh (at least, maybe others) don't load RC files when in non-interactive mode, even when using -l (login) option shellArgs.push("-i"); + command = ` ${command}`; // This prevents the command from being added to the history } else { // Some shells don't support any other options when providing the -l (login) shell option } diff --git a/src/features/shell-sync/main/compute-unix-shell-environment.test.ts b/src/features/shell-sync/main/compute-unix-shell-environment.test.ts index 55766fbb8a..a540824286 100644 --- a/src/features/shell-sync/main/compute-unix-shell-environment.test.ts +++ b/src/features/shell-sync/main/compute-unix-shell-environment.test.ts @@ -218,7 +218,7 @@ describe("computeUnixShellEnvironment technical tests", () => { }); it("should send the command via stdin", () => { - expect(stdinValue).toBe(`'/some/process/exec/path' -p '"deadbeef" + JSON.stringify(process.env) + "deadbeef"'`); + expect(stdinValue).toBe(` '/some/process/exec/path' -p '"deadbeef" + JSON.stringify(process.env) + "deadbeef"'`); }); it("should close stdin", () => {