summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2017-04-01 10:44:57 -0700
committerLamont Granquist <lamont@scriptkiddie.org>2017-04-01 10:44:57 -0700
commit20b53061202d63d3acc29bffa317935a354abd5f (patch)
treeaf89c2f61dc2ce16f847372a86ccaf84583e7c8e
parent9a42b4d5588013d36e4357702911119400cc1ef4 (diff)
downloadchef-20b53061202d63d3acc29bffa317935a354abd5f.tar.gz
try using pty on aix with ruby 2.4
perhaps this has been fixed now? Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
-rw-r--r--spec/functional/shell_spec.rb58
1 files changed, 20 insertions, 38 deletions
diff --git a/spec/functional/shell_spec.rb b/spec/functional/shell_spec.rb
index f4d8a06b52..08c791f2d2 100644
--- a/spec/functional/shell_spec.rb
+++ b/spec/functional/shell_spec.rb
@@ -77,44 +77,26 @@ describe Shell do
end
def run_chef_shell_with(options)
- case ohai[:platform]
- when "aix"
- config = File.expand_path("shef-config.rb", CHEF_SPEC_DATA)
- path_to_chef_shell = File.expand_path("../../../bin/chef-shell", __FILE__)
- output = ""
- status = popen4("#{path_to_chef_shell} -c #{config} #{options}", :waitlast => true) do |pid, stdin, stdout, stderr|
- read_until(stdout, "chef (#{Chef::VERSION})>")
- yield stdout, stdin if block_given?
- stdin.write("'done'\n")
- output = read_until(stdout, '=> "done"')
- stdin.print("exit\n")
- flush_output(stdout)
- end
-
- [output, status.exitstatus]
- else
- # Windows ruby installs don't (always?) have PTY,
- # so hide the require here
- begin
- require "pty"
- config = File.expand_path("shef-config.rb", CHEF_SPEC_DATA)
- path_to_chef_shell = File.expand_path("../../../bin/chef-shell", __FILE__)
- reader, writer, pid = PTY.spawn("#{path_to_chef_shell} -c #{config} #{options}")
- read_until(reader, "chef (#{Chef::VERSION})>")
- yield reader, writer if block_given?
- writer.puts('"done"')
- output = read_until(reader, '=> "done"')
- writer.print("exit\n")
- flush_output(reader)
- writer.close
-
- exitstatus = wait_or_die(pid)
-
- [output, exitstatus]
- rescue PTY::ChildExited => e
- [output, e.status]
- end
- end
+ # Windows ruby installs don't (always?) have PTY,
+ # so hide the require here
+
+ require "pty"
+ config = File.expand_path("shef-config.rb", CHEF_SPEC_DATA)
+ path_to_chef_shell = File.expand_path("../../../bin/chef-shell", __FILE__)
+ reader, writer, pid = PTY.spawn("#{path_to_chef_shell} -c #{config} #{options}")
+ read_until(reader, "chef (#{Chef::VERSION})>")
+ yield reader, writer if block_given?
+ writer.puts('"done"')
+ output = read_until(reader, '=> "done"')
+ writer.print("exit\n")
+ flush_output(reader)
+ writer.close
+
+ exitstatus = wait_or_die(pid)
+
+ [output, exitstatus]
+ rescue PTY::ChildExited => e
+ [output, e.status]
end
it "boots correctly with -lauto" do