From 0e41241faac44e3f495b2368508a489dfa93d30f Mon Sep 17 00:00:00 2001 From: Eric Wheeler Date: Mon, 3 Mar 2025 21:27:50 -0800 Subject: [PATCH] fix: replace echo -e with printf in terminal tests Replace echo -e with printf command in terminal tests for better portability. - Replace echo -e with printf to ensure consistent behavior across different shell implementations - Not all implementations of echo support the -e flag for interpreting backslash escapes - Using printf provides a more reliable way to handle escape sequences Signed-off-by: Eric Wheeler --- .../terminal/__tests__/TerminalProcessExec.test.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/integrations/terminal/__tests__/TerminalProcessExec.test.ts b/src/integrations/terminal/__tests__/TerminalProcessExec.test.ts index 1c02abbf91..0952e6aef1 100644 --- a/src/integrations/terminal/__tests__/TerminalProcessExec.test.ts +++ b/src/integrations/terminal/__tests__/TerminalProcessExec.test.ts @@ -225,10 +225,10 @@ describe("TerminalProcess with Real Command Output", () => { ) }) - it("should execute 'echo -e \"a\\nb\"' and return 'a\\nb\\n'", async () => { - const { executionTimeUs } = await testTerminalCommand('echo -e "a\\nb"', "a\nb\n") + it("should execute 'printf \"a\\nb\\n\"' and return 'a\\nb\\n'", async () => { + const { executionTimeUs } = await testTerminalCommand('printf "a\\nb\\n"', "a\nb\n") console.log( - `'echo -e "a\\nb"' execution time: ${executionTimeUs} microseconds (${executionTimeUs / 1000} milliseconds)`, + `'printf "a\\nb\\n"' execution time: ${executionTimeUs} microseconds (${executionTimeUs / 1000} milliseconds)`, ) })