From 69ff603ea78c4bca839f0146d98c33cdfe053320 Mon Sep 17 00:00:00 2001 From: eleanorjboyd <26030610+eleanorjboyd@users.noreply.github.com> Date: Tue, 7 Oct 2025 11:15:36 -0700 Subject: [PATCH] Refactor quoteStringIfNecessary to improve handling of single shell operators --- src/features/execution/execUtils.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/features/execution/execUtils.ts b/src/features/execution/execUtils.ts index b5f4671a..6804d85d 100644 --- a/src/features/execution/execUtils.ts +++ b/src/features/execution/execUtils.ts @@ -4,6 +4,11 @@ export function quoteStringIfNecessary(arg: string): string { return arg; } + // Don't quote single shell operators/special characters + if (arg.length === 1 && /[&|<>;()[\]{}$]/.test(arg)) { + return arg; + } + // Quote if contains common shell special characters that are problematic across multiple shells // Includes: space, &, |, <, >, ;, ', ", `, (, ), [, ], {, }, $ const needsQuoting = /[\s&|<>;'"`()\[\]{}$]/.test(arg);