(command: string)
| 91 | * @returns true if stdin redirect can be safely added |
| 92 | */ |
| 93 | export function shouldAddStdinRedirect(command: string): boolean { |
| 94 | // Don't add stdin redirect for heredocs as it interferes with the heredoc terminator |
| 95 | if (containsHeredoc(command)) { |
| 96 | return false |
| 97 | } |
| 98 | |
| 99 | // Don't add stdin redirect if command already has one |
| 100 | if (hasStdinRedirect(command)) { |
| 101 | return false |
| 102 | } |
| 103 | |
| 104 | // For other commands, stdin redirect is generally safe |
| 105 | return true |
| 106 | } |
| 107 | |
| 108 | /** |
| 109 | * Rewrites Windows CMD-style `>nul` redirects to POSIX `/dev/null`. |
no test coverage detected