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 <roo-code@z.ewheeler.org>
This commit is contained in:
Eric Wheeler 2025-03-03 21:27:50 -08:00
parent e24e5b24d4
commit 0e41241faa

View file

@ -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)`,
)
})