R/pipe.R
raw| 1 | |
| 2 | renv_pipe_create <- function(command, open = "r", encoding = "native.enc") { |
| 3 | |
| 4 | # on Windows, pipe() invokes cmd.exe /c <command>; when the command |
| 5 | # starts with a quoted path, cmd.exe strips the first and last quote |
| 6 | # characters from the entire line, breaking inner quotes. wrapping the |
| 7 | # whole command in an extra pair of quotes prevents this. |
| 8 | if (renv_platform_windows()) |
| 9 | command <- paste0("\"", command, "\"") |
| 10 | |
| 11 | pipe(command, open = open, encoding = encoding) |
| 12 | |
| 13 | } |