【发布时间】:2018-05-19 14:57:17
【问题描述】:
当我从cmd 行启动运行shiny 应用程序的R 脚本时,它似乎启动了Rscript.exe 的两个 实例?我总是可以杀死两者中较小的一个并且应用程序继续运行?有人可以详细说明幕后实际发生的事情,或者告诉我我做错了什么,造成了双重进程吗?
super_simple.R
require(shiny)
app <- shinyApp(
ui = bootstrapPage(
numericInput('n', 'Number of obs', 100),
plotOutput('plot')
),
server = function(input, output) {
output$plot <- renderPlot({ hist(runif(input$n)) })
}
)
runApp(app, launch.browser = FALSE, port = 1234, host = "10.123.4.56")
现在,如果我通过cmd 线启动它:
START Rscript --vanilla C:\Users\Jason\Projects\super_simple.R
此时,我可以将浏览器指向http://10.123.4.56:1234 并查看应用程序。但是,如果我通过以下方式查看正在运行的进程:tasklist /FI "imagename eq rscript*" 我会看到 两个 Rscript.exe 进程:
然而,我已经确定,我总是可以杀死两者中较小的一个(例如,taskkill /pid 9360 /f),但应用程序仍然可以完整运行?注意:我尝试通过START \b ... 在后台启动命令,但结果是一样的。
【问题讨论】:
-
我猜一个实例运行你的脚本,
runApp只为应用程序本身创建第二个实例。
标签: r cmd shiny shiny-server