diff --git a/packages/core/src/utils/shell-utils.test.ts b/packages/core/src/utils/shell-utils.test.ts index 81b43abf50..933ca84817 100644 --- a/packages/core/src/utils/shell-utils.test.ts +++ b/packages/core/src/utils/shell-utils.test.ts @@ -119,8 +119,10 @@ describe('getCommandRoots', () => { expect(getCommandRoots('ls -l')).toEqual(['ls']); }); - it('should handle paths and return the binary name', () => { - expect(getCommandRoots('/usr/local/bin/node script.js')).toEqual(['node']); + it('should handle paths and return the full path', () => { + expect(getCommandRoots('/usr/local/bin/node script.js')).toEqual([ + '/usr/local/bin/node', + ]); }); it('should return an empty array for an empty string', () => { diff --git a/packages/core/src/utils/shell-utils.ts b/packages/core/src/utils/shell-utils.ts index 89f50a9ce7..d2b28a348c 100644 --- a/packages/core/src/utils/shell-utils.ts +++ b/packages/core/src/utils/shell-utils.ts @@ -264,11 +264,7 @@ function normalizeCommandName(raw: string): string { return raw.slice(1, -1); } } - const trimmed = raw.trim(); - if (!trimmed) { - return trimmed; - } - return trimmed.split(/[\\/]/).pop() ?? trimmed; + return raw.trim(); } function extractNameFromNode(node: Node): string | null {