I have a simple Ruby (Sinatra) server that starts up without issue from the command line with ruby app.rb. But when I execute the same command via my command line app, either with `ruby app.rb` or with system("ruby app.rb"), I get this error:
app.rb:1:in `require': cannot load such file -- sinatra (LoadError)
    from app.rb:1:in `<main>'
The opening line of app.rb is simply require 'sinatra'. The Sinatra gem is installed in my system, of course; I don't understand why the interpreter is acting as if it's not there.
While troubleshooting, I decided to add Sinatra to the Gemfile of the command line app that is calling app.rb. Lo and behold, now that the parent process has access to Sinatra, now it works (i.e., system(app.rb) successfully starts the Sinatra server). But when I exit the command line app, a Sinatra server is always there, saying:
[2018-12-18 23:17:37] INFO  WEBrick 1.3.1
[2018-12-18 23:17:37] INFO  ruby 2.4.0 (2016-12-24) [x86_64-linux]
== Sinatra (v2.0.4) has taken the stage on 4567 for development with backup from WEBrick
[2018-12-18 23:17:37] INFO  WEBrick::HTTPServer#start: pid=27384 port=4567
So I have to Ctrl-c to exit the command line app.
Question: Is there a way to spawn an independent Sinatra process/server, as I was trying to do with system("ruby app.rb"), without installing it in the parent app (the command line app)? I also tried using Process.fork followed by Process.wait, but that didn't help.
