title: Ruby - Running rb files from script (2)
body: <p>I'd like to write a ruby script that then calls another ruby script. Example, I'd like to run the "test1.rb" from my script. The test1.rb has been simplified to just do this:</p>
  
  <pre><code>print "1"
  </code></pre>
  
  <p>Then get the result (-> 1).</p>
  
  <p>I ask to help others to fix this problem, and they suggested the popen3 command:</p>
  
  <pre><code>require 'open3'
  cmd = 'ruby "test1.rb"'
  puts Dir.pwd
  Open3.popen3(cmd) do |stdin, stdout|
      var = stdout.read
      puts var
  end
  </code></pre>
  
  <p>However, the script send an error message:</p>
  
  <pre><code>X:/Ruby22-x64/lib/ruby/2.2.0/open3.rb:193:in `spawn': No such file or directory
  - ruby "test1.rb" (Errno::ENOENT)
  </code></pre>
  
  <p>Please help me.</p>