| 276 | } |
| 277 | |
| 278 | export class TrueRemotePathMappedRuntime extends RemoteRuntime { |
| 279 | private readonly delegate: RemotePathMappedRuntime; |
| 280 | private readonly remoteBase: string; |
| 281 | |
| 282 | constructor(localBase: string, remoteBase: string) { |
| 283 | super(); |
| 284 | this.remoteBase = remoteBase === "/" ? remoteBase : remoteBase.replace(/\/+$/u, ""); |
| 285 | this.delegate = new RemotePathMappedRuntime(localBase, remoteBase); |
| 286 | } |
| 287 | |
| 288 | protected readonly commandPrefix = "TestRemoteRuntime"; |
| 289 | |
| 290 | protected spawnRemoteProcess(): Promise<SpawnResult> { |
| 291 | throw new Error("spawnRemoteProcess should not be called"); |
| 292 | } |
| 293 | |
| 294 | protected getBasePath(): string { |
| 295 | return this.remoteBase; |
| 296 | } |
| 297 | |
| 298 | protected quoteForRemote(targetPath: string): string { |
| 299 | return `'${targetPath.replaceAll("'", "'\\''")}'`; |
| 300 | } |
| 301 | |
| 302 | protected cdCommand(cwd: string): string { |
| 303 | return `cd ${this.quoteForRemote(cwd)}`; |
| 304 | } |
| 305 | |
| 306 | override exec( |
| 307 | command: string, |
| 308 | options: Parameters<LocalRuntime["exec"]>[1] |
| 309 | ): ReturnType<LocalRuntime["exec"]> { |
| 310 | return this.delegate.exec(command, options); |
| 311 | } |
| 312 | |
| 313 | override normalizePath(targetPath: string, basePath: string): string { |
| 314 | return this.delegate.normalizePath(targetPath, basePath); |
| 315 | } |
| 316 | |
| 317 | override resolvePath(filePath: string): Promise<string> { |
| 318 | return this.delegate.resolvePath(filePath); |
| 319 | } |
| 320 | |
| 321 | override getWorkspacePath(projectPath: string, workspaceName: string): string { |
| 322 | return this.delegate.getWorkspacePath(projectPath, workspaceName); |
| 323 | } |
| 324 | |
| 325 | override stat(filePath: string, abortSignal?: AbortSignal): ReturnType<LocalRuntime["stat"]> { |
| 326 | return this.delegate.stat(filePath, abortSignal); |
| 327 | } |
| 328 | |
| 329 | override readFile( |
| 330 | filePath: string, |
| 331 | abortSignal?: AbortSignal |
| 332 | ): ReturnType<LocalRuntime["readFile"]> { |
| 333 | return this.delegate.readFile(filePath, abortSignal); |
| 334 | } |
| 335 |
nothing calls this directly
no outgoing calls
no test coverage detected