Sha256: a4288b5818752fb16acdc98e3e2bf5492406f354e7b70ee49300dedf42229a25

Contents?: true

Size: 703 Bytes

Versions: 129

Compression:

Stored size: 703 Bytes

Contents

# Ref: https://github.com/sorah/infra_operator/blob/6259aada3fdd9d4bed5759115d39bd1df25a81f2/spec/backends/exec_spec.rb#L36

require 'spec_helper'

context "when executed process launches child process like a daemon, and the daemon doesn't close stdout,err" do
  before :all do
    set :backend, :exec
  end

  subject(:result) { Specinfra::Runner.run_command("ruby -e 'pid = fork { sleep 10; puts :bye }; Process.detach(pid); puts pid'") }

  it "doesn't block" do
    a = Time.now
    result # exec
    b = Time.now
    expect((b-a) < 3).to be_truthy

    expect(result.stderr).to be_empty
    expect(result.stdout.chomp).to match(/\A\d+\z/)
    Process.kill :TERM, result.stdout.chomp.to_i
  end
end

Version data entries

129 entries across 129 versions & 1 rubygems

Version Path
specinfra-2.66.6 spec/backend/exec/child_process_spec.rb
specinfra-2.66.5 spec/backend/exec/child_process_spec.rb
specinfra-2.66.4 spec/backend/exec/child_process_spec.rb
specinfra-2.66.3 spec/backend/exec/child_process_spec.rb
specinfra-2.66.2 spec/backend/exec/child_process_spec.rb
specinfra-2.66.1 spec/backend/exec/child_process_spec.rb
specinfra-2.66.0 spec/backend/exec/child_process_spec.rb
specinfra-2.65.0 spec/backend/exec/child_process_spec.rb
specinfra-2.64.0 spec/backend/exec/child_process_spec.rb
specinfra-2.63.3 spec/backend/exec/child_process_spec.rb
specinfra-2.63.2 spec/backend/exec/child_process_spec.rb
specinfra-2.63.1 spec/backend/exec/child_process_spec.rb
specinfra-2.63.0 spec/backend/exec/child_process_spec.rb
specinfra-2.62.0 spec/backend/exec/child_process_spec.rb
specinfra-2.61.3 spec/backend/exec/child_process_spec.rb
specinfra-2.61.2 spec/backend/exec/child_process_spec.rb
specinfra-2.61.1 spec/backend/exec/child_process_spec.rb
specinfra-2.61.0 spec/backend/exec/child_process_spec.rb
specinfra-2.60.4 spec/backend/exec/child_process_spec.rb
specinfra-2.60.3 spec/backend/exec/child_process_spec.rb