Commit cb8ad965 authored by charlie-ablett's avatar charlie-ablett

Use popen3 instead of popen2e, pipe terminal output to notes.

parent 3b5cdc06
PATH
remote: .
specs:
ink_step (0.1.10)
ink_step (0.1.11)
awesome_print
httparty
rubyzip
......
......@@ -10,7 +10,7 @@ module InkStep
include Mixins::ShellMethods
attr_accessor :next_step, :errors, :status_code, :required_parameters, :process_step,
:started_at, :finished_at, :position, :chain_file_location, :successful
:started_at, :finished_at, :position, :chain_file_location, :successful, :notes
INPUT_FILE_DIRECTORY_NAME = "input_files"
OUTPUT_FILE_DIRECTORY_NAME = "output_files"
......@@ -22,6 +22,7 @@ module InkStep
@errors = []
@required_parameters = []
@successful = nil
@notes = []
end
def self.require_parameters(*value)
......
......@@ -64,10 +64,11 @@ module InkStep
def perform_command(command:, error_prefix: "Error", print_out: false)
log_as_step "running #{command}"
Open3.popen2e(command) do |stdin, stdout_err, wait_thr|
Open3.popen3(command) do |stdin, stdout, stderr, wait_thr|
exit_status = wait_thr.value
@success = exit_status.success?
err = stdout_err.read
err = stderr.read
@notes << stdout.read
if @success
@errors << err if print_out
else
......
module InkStep
VERSION = '0.1.10'
VERSION = '0.1.11'
end
\ No newline at end of file
......@@ -18,8 +18,8 @@ describe InkStep::Base do
describe '#find_source_files' do
let!(:working_directory) { subject.send(:working_directory) }
let(:doc1) { "foo/bar baz/document.html" }
let(:doc2) { "secret doc.docx" }
let(:doc1) { 'foo/bar baz/document.html' }
let(:doc2) { 'secret doc.docx' }
let(:file_list) { [doc1, doc2] }
before do
......@@ -36,6 +36,10 @@ describe InkStep::Base do
expect(subject.find_source_file(regex: /secret doc\.docx/)).to eq doc2
end
it 'matches files in subdirectories with part file names with spaces' do
expect(subject.find_source_file(regex: /secret/)).to eq doc2
end
it 'matches files in subdirectories with partial filenames' do
expect{subject.find_source_file(regex: /doc/)}.to raise_error(/Multiple files/)
end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment