Skip to content

Instantly share code, notes, and snippets.

@Marahin

Marahin/irb.rb Secret

Created November 16, 2018 16:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Marahin/71d1734cd98df15458c4d575f5c66d3d to your computer and use it in GitHub Desktop.
Save Marahin/71d1734cd98df15458c4d575f5c66d3d to your computer and use it in GitHub Desktop.
irb
irb(main):001:0> #!/usr/bin/env ruby
irb(main):002:0*
irb(main):003:0* JOBS = [
irb(main):004:1* "bin/rspec_rerun spec",
irb(main):005:1* "bin/quality"
irb(main):006:1> ].freeze
=> ["bin/rspec_rerun spec", "bin/quality"]
irb(main):007:0>
irb(main):008:0* child_pids = JOBS.map do |job|
irb(main):009:1* child_pid = fork { `#{job}` }
irb(main):010:1> sleep 0.1
irb(main):011:1> Process.detach(child_pid)
irb(main):012:1>
irb(main):013:1* child_pid
irb(main):014:1> end
=> [11257, 11259]
[1] + 11262 suspended (tty output) bundled_irb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment