Skip to content

Commit 7bc0f14

Browse files
committed
refactor: cleanup
1 parent e507ef9 commit 7bc0f14

File tree

1 file changed

+1
-22
lines changed

1 file changed

+1
-22
lines changed

bin/package-manager-completion.ts

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,7 @@ function runCompletionCommand(
2727
leadingArgs: string[],
2828
completionArgs: string[]
2929
): string {
30-
const safeCompletionArgs =
31-
completionArgs.length === 0 ? [''] : completionArgs;
32-
33-
const args = [...leadingArgs, 'complete', '--', ...safeCompletionArgs];
30+
const args = [...leadingArgs, 'complete', '--', ...completionArgs];
3431

3532
// PowerShell: prefer invoking via powershell.exe so .ps1 shims are resolved.
3633
if (isPowerShellEnv && path.extname(command) === '') {
@@ -39,16 +36,6 @@ function runCompletionCommand(
3936

4037
const result = spawnSync(command, args, completionSpawnOptions);
4138

42-
if (result.error) {
43-
throw result.error;
44-
}
45-
46-
if (typeof result.status === 'number' && result.status !== 0) {
47-
throw new Error(
48-
`Completion command "${command}" exited with code ${result.status}`
49-
);
50-
}
51-
5239
return (result.stdout ?? '').trim();
5340
}
5441

@@ -74,14 +61,6 @@ function runCompletionViaPowerShell(command: string, args: string[]): string {
7461
completionSpawnOptions
7562
);
7663

77-
if (psResult.error) {
78-
throw psResult.error;
79-
}
80-
if (typeof psResult.status === 'number' && psResult.status !== 0) {
81-
throw new Error(
82-
`Completion command "${command}" (PowerShell) exited with code ${psResult.status}`
83-
);
84-
}
8564
return (psResult.stdout ?? '').trim();
8665
}
8766

0 commit comments

Comments
 (0)