title: run app from terminal error with rstudioapi::selectDirectory
body: <p>I want to launch a shiny application from a terminal. My application has a button that when pressed opens a window to select a folder with the function <strong>rstudioapi::selectDirectory()</strong></p>
  
  <p>But when i click on the button i get this error:</p>
  
  <pre><code>Warning: Error in : RStudio not running
    76: stop
    75: verifyAvailable
    74: callFun
    73: rstudioapi::selectDirectory
    72: observeEventHandler [D:/Users/folder/Shiny/app.R#12]
     1: shiny::runApp
  </code></pre>
  
  <p><strong>app.R</strong> </p>
  
  <pre><code>library(shiny)
  
  # Define UI for application that draws a histogram
  ui &lt;- fluidPage(
  
    actionButton("folder", "Choose folder")
  
  )
  
  server &lt;- function(input, output) {
    observeEvent(input$folder, {
      path.file &lt;- rstudioapi::selectDirectory()
      print(path.file)
    })
  
  }
  
  # Run the application
  shinyApp(ui = ui, server = server)
  </code></pre>
  
  <p><strong>on a terminal</strong></p>
  
  <pre><code>$ "Rscript.exe" -e "shiny::runApp('Shiny/app.R')"
  Loading required package: shiny
  Warning: package 'shiny' was built under R version 3.5.3
  
  Listening on http://127.0.0.1:6283
  Warning: Error in : RStudio not running
    76: stop
    75: verifyAvailable
    74: callFun
    73: rstudioapi::selectDirectory
    72: observeEventHandler [D:/Users/folder/Shiny/app.R#12]
     1: shiny::runApp
  </code></pre>