Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8966707
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T17:04:38+00:00 2026-06-15T17:04:38+00:00

Possible Duplicate: Spawn a background process in Ruby Spent a couple days poking at

  • 0

Possible Duplicate:
Spawn a background process in Ruby

Spent a couple days poking at this. I was using ruby 1.8.7 from the OS until recently. I would call a subshell with backticks. The subshell was a bash wrapper that would call run any program in the background with stdout and stderr both closed. It then ran disown to let init take over the process and it would return immediately. This worked great for years, where I would have this looping process kick off jobs in the background and immediately report back “yes, it ran, that’s all I am telling you”.

I upgraded everything to rvm 1.9.3 and everything’s fine except for this trick. I’m starting to suspect it’s more of a hack than I want to admit. In 1.9.3, I always get an EPIPE error when I spawn that subshell. It says that it has a broken pipe. I can accept that it isn’t going to work in 1.9.3 since it seems kinda gross what I was doing in 1.8.7.

I’ve tried using the system command and I have tried open3:popen2. They also both throw an EPIPE with me calling the disown wrapper.

#!/bin/bash

# this will crash ruby if you keep trying to read from it.
$* >&- &

disown %1

This is the disown wrapper. In ruby I have something like

    r=`/usr/local/bin/disown /usr/local/bin/job.sh`

And when this runs, it throws

/usr/local/bin/runner.rb:88:in ``': Broken pipe (Errno::EPIPE)

If I don’t assign the (zero) output to the r variable, the effect is identical. And with the system function and Open3:popen2.

So my goal is to simply run a command from ruby and not wait for it to come back. It takes several hours and I do not need to track it, just spawn it. I might try a worker thread pool if it begins to sound like ruby can no longer do this, or if my disown wrapper is too heinous to get any approval. Ok. Thanks.

*edit: Thanks for the great answers everyone. I think Casper showed me that if I had a better handle on the ruby lingo, I probably would have zeroed in on this. Sorry if this a little pedestrian. I appreciate the quick answers, everyone!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T17:04:39+00:00Added an answer on June 15, 2026 at 5:04 pm

    in Ruby 1.9.3, u can use

     Process.fork do
       # do your long time job
     end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: C# Spawn Multiple Threads for work then wait until all finished I
Possible Duplicate: How do I spawn threads on different CPU cores? I am using
Possible Duplicate: Using C# regular expressions to remove HTML tags Extract Content from Div
Possible Duplicate: Can a span be closed using <span />? <p>This is a test
Possible Duplicate: How do I make a request using HTTP basic authentication with PHP
Possible Duplicate: How can I understand nested ?: operators in PHP? Why does this:
Possible Duplicate: Can main function call itself in C++? I found this problem very
Possible Duplicate: The following bash command will spawn processes to kernel death. Can you
Possible Duplicate: How to show/hide a div on mouseover using jquery? I have a
Possible Duplicate: What's the point of valid CSS/HTML? This is a over-asked question, but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.