Skip to content

Commit

Permalink
tweak after #1034: use shell() instead of system2() to run ImageMagic…
Browse files Browse the repository at this point in the history
…k's convert, since system()/system2() may not fully respect the system's PATH

http://comments.gmane.org/gmane.comp.lang.r.devel/38113
  • Loading branch information
yihui committed May 23, 2015
1 parent 38350d4 commit 2fdacff
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion R/plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,13 @@ plot_crop = function(x, quiet = !opts_knit$get('progress')) {
cmd = 'convert'
args = c(x, '-trim', x)
}
system2(cmd, args = args, stdout = if (quiet) FALSE else "")
# see this post for why use shell() on Windoz:
# http://comments.gmane.org/gmane.comp.lang.r.devel/38113
if (is_windows() && cmd == 'convert') {
shell(paste(cmd, args)) # no way to quiet cmd output on Windoz
} else {
system2(cmd, args = args, stdout = if (quiet) FALSE else "")
}
x
}

Expand Down

0 comments on commit 2fdacff

Please sign in to comment.