问题描述
根据 , system2
函数的 stdout
参数可以将输出重定向到文件。这似乎可以在Unix上使用,但是我无法在Windows上使用。下面的玩具示例中,没有创建 out.txt
或 err.txt
文件。我尝试将其发送到现有文件,或扩展完整文件路径,但没有成功:
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")
我做错什么了吗?或者这是 system2
的限制吗?
Am I doing something wrong or is this a limitation in system2
?
推荐答案
我非常确信现在这是Windows中RGui.exe中的错误。我在此处提交了错误报告:
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
这篇关于将System2标准输出重定向到Windows上的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!