MCPcopy Create free account
hub / github.com/coder/mux / isCandidateAvailable

Function isCandidateAvailable

src/node/utils/main/resolveLocalPtyShell.ts:99–115  ·  view source on GitHub ↗
(
  command: string,
  deps: {
    isCommandAvailable: (candidateCommand: string) => boolean;
    isPathAccessible: (candidatePath: string) => boolean;
  }
)

Source from the content-addressed store, hash-verified

97}
98
99function isCandidateAvailable(
100 command: string,
101 deps: {
102 isCommandAvailable: (candidateCommand: string) => boolean;
103 isPathAccessible: (candidatePath: string) => boolean;
104 }
105): boolean {
106 if (!command) {
107 return false;
108 }
109
110 if (isPathLikeShell(command)) {
111 return deps.isPathAccessible(command);
112 }
113
114 return deps.isCommandAvailable(command);
115}
116
117function looksLikeWslShell(envShell: string): boolean {
118 // WSL (and other Unix-like environments) often surface POSIX-y paths like `/bin/bash`.

Callers 1

resolveLocalPtyShellFunction · 0.85

Calls 2

isPathLikeShellFunction · 0.85
isCommandAvailableMethod · 0.80

Tested by

no test coverage detected