来自Shiny的系统调用

时间:2015-08-19 22:51:51

标签: r shiny

我尝试使用Shiny构建一个应用程序,允许用户加载CSV文件,在其中进行分析并在Redshift中生成Create Table DDL。

为此,我使用csvkit的csvsql,我在CentOS 6.5上测试它并运行R 3.2.1。 http://csvkit.readthedocs.org/en/latest/scripts/csvsql.html

当我su su作为闪亮的用户,然后运行

system('csvsql -i postgresql /srv/shiny-server/temp/tempcsv.csv >> /srv/shiny-server/temp/sql.sql')

它按预期创建一个带有create table DDL的sql.sql文件。

但是,当我在web-app中运行它时,会生成一个空的sql.sql文件。

output$sql <- renderText({
system('echo test >> /srv/shiny-server/tablecreator/temp/test.txt')
system('csvsql -i postgresql /srv/shiny-server/temp/tempcsv.csv >> /srv/shiny-server/temp/sql.sql')
system('echo testtwo >> /srv/shiny-server/tablecreator/temp/test.txt')
print('finished')
})

我能够看到&#34;测试&#34;和&#34; testtwo&#34;在test.txt文件中,以及在UI中呈现&#34;已完成&#34;正常。

我还尝试将系统调用放在他们自己的.R文件中,并使用isolate with source和&#34; local = TRUE&#34;,但它仍然会生成一个空输出。

这似乎向我表明系统调用没有按预期工作,但我真的不知道如何调试这个除了sudo之外的闪亮和测试命令(有效)

非常感谢任何帮助。

0 个答案:

没有答案