Rails 执行系统命令且日志重定向

magic · January 13, 2014 · Last by Magic replied at January 14, 2014 · 3137 hits

这两天遇到一个问题,在 Rails 里需要调用系统命令用 system 函数,如下:

system("#{command} > #{log_path}")

但是结果是命令是执行了,但是执行日志没有输出到 log 文件里;请问是为什么呢?

没有读写磁盘的权限?

system("#{command}", :out =>["#{log_path}", 'a'])

You need to Sign in before reply, if you don't have an account, please Sign up first.