(gameArgs: string | string[])
| 441 | * @param gameArgs Argument(s) to escape |
| 442 | */ |
| 443 | export function escapeArgsForShell(gameArgs: string | string[]): string[] { |
| 444 | if (typeof gameArgs === 'string') { |
| 445 | switch (process.platform) { |
| 446 | case 'win32': |
| 447 | return [`${escapeWin(gameArgs)}`]; |
| 448 | case 'darwin': |
| 449 | case 'linux': |
| 450 | return [`${escapeLinuxArgs(gameArgs)}`]; |
| 451 | default: |
| 452 | throw Error('Unsupported platform'); |
| 453 | } |
| 454 | } else { |
| 455 | switch (process.platform) { |
| 456 | case 'win32': |
| 457 | return gameArgs.map(a => `${escapeWin(a)}`); |
| 458 | case 'darwin': |
| 459 | case 'linux': |
| 460 | return gameArgs.map(a => `${escapeLinuxArgs(a)}`); |
| 461 | default: |
| 462 | throw Error('Unsupported platform'); |
| 463 | } |
| 464 | } |
| 465 | } |
| 466 | |
| 467 | /** |
| 468 | * Escape a string that will be used in a Windows shell (command line) |
no test coverage detected