Redirect system2 stdout to a file on windows

一世执手 提交于 2019-12-31 01:52:07

问题


According to the manual, the stdout argument of the system2 function can redirect output to a file. This seems to work on unix, however I can't get it to work on windows. The toy example below, no out.txt or err.txt files are created. I tried sending it to an existing file, or expand the full file path, but with no success:

setwd(tempdir())
system2("whoami", stdout="out.txt", stderr="err.txt")
file.exists("out.txt")

Am I doing something wrong or is this a limitation in system2 ?


回答1:


I'm quite convinced now this is a bug in RGui.exe in windows. I filed a bug report here: https://bugs.r-project.org/bugzilla3/show_bug.cgi?id=15393



来源:https://stackoverflow.com/questions/17638090/redirect-system2-stdout-to-a-file-on-windows

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!