Sha256: 7f8dc2294e5ab0f864e32f14d276b849e48a254e3ea33c301dcd85400f829a45

Contents?: true

Size: 655 Bytes

Versions: 66

Compression:

Stored size: 655 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
  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

66 entries across 66 versions & 3 rubygems

Version Path
specinfra-rb19-2.44.7 spec/backend/exec/child_process_spec.rb
specinfra-2.59.0 spec/backend/exec/child_process_spec.rb
specinfra-2.58.0 spec/backend/exec/child_process_spec.rb
specinfra-2.57.5 spec/backend/exec/child_process_spec.rb
specinfra-2.57.4 spec/backend/exec/child_process_spec.rb
specinfra-2.57.3 spec/backend/exec/child_process_spec.rb
specinfra-2.57.2 spec/backend/exec/child_process_spec.rb
specinfra-2.57.1 spec/backend/exec/child_process_spec.rb
specinfra-cisco-2.41.0 spec/backend/exec/child_process_spec.rb
specinfra-2.57.0 spec/backend/exec/child_process_spec.rb
specinfra-2.56.1 spec/backend/exec/child_process_spec.rb
specinfra-2.56.0 spec/backend/exec/child_process_spec.rb
specinfra-2.55.0 spec/backend/exec/child_process_spec.rb
specinfra-2.54.2 spec/backend/exec/child_process_spec.rb
specinfra-2.54.1 spec/backend/exec/child_process_spec.rb
specinfra-2.54.0 spec/backend/exec/child_process_spec.rb
specinfra-2.53.1 spec/backend/exec/child_process_spec.rb
specinfra-2.53.0 spec/backend/exec/child_process_spec.rb
specinfra-2.52.0 spec/backend/exec/child_process_spec.rb
specinfra-2.51.2 spec/backend/exec/child_process_spec.rb