title: Ruby net/ssh is not running bash commands in background
body: <p>I am having a hard time running bash commands in background from a Ruby script.</p>
  <p>For this question, I am using a simplified example.</p>
  <p>This is how commands are working as expected when I run them from PuTTY.</p>
  <p><a href="https://i.stack.imgur.com/FManZ.png" rel="nofollow noreferrer">running basch commands in background</a>
  (click to see the picture, because StackOverlow is not allowing me to show pictures yet)</p>
  <p>Now, I try to replicate this from Ruby, using this little script shown below:</p>
  <p><a href="https://i.stack.imgur.com/uLinG.png" rel="nofollow noreferrer">ruby script</a>
  (click to see the picture, because StackOverlow is not allowing me to show pictures yet)</p>
  <p>This is the outout I get when I run such a Ruby script:</p>
  <p><a href="https://i.stack.imgur.com/Z19Qm.png" rel="nofollow noreferrer">script output</a>
  (click to see the picture, because StackOverlow is not allowing me to show pictures yet)</p>
  <p>For your analysis, here is the transcription of the Ruby script:</p>
  <pre><code>require 'net/ssh'
  net_remote_ip = '74.****122'
  ssh_username = 'bots'
  ssh_password = 'San*****'
  get_ssh_port = '22'
  ssh = Net::SSH.start(net_remote_ip, ssh_username, :password =&gt; ssh_password, :port =&gt; get_ssh_port)
  s = &quot;bash --login -c 'sleep 600' &amp;&quot;
  print &quot;run (#{s})... &quot;
  stdout = ssh.exec!(s)
  puts &quot;done (#{stdout.strip})&quot;
  ssh.close
  exit(0)
  </code></pre>