-
-
Notifications
You must be signed in to change notification settings - Fork 161
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow multiple arguments to xProcess#write #634
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code looks nicer, now.
lib/aruba/processes/basic_process.rb
Outdated
end | ||
|
||
def stderr(*) | ||
NotImplementedError | ||
raise NotImplementedError |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good fix!
@@ -99,12 +99,11 @@ def stderr(*) | |||
@stderr.string | |||
end | |||
|
|||
# Write strint to stdin | |||
# Write strings to stdin |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, again, tidy!
it 'it shows useful info' do | ||
expected = /#<#<Class:0x[0-9A-Fa-f]+>:\d+ commandline="foobar": stdout="foo output" stderr="foo error output"/ | ||
expect(subject.inspect).to match(expected) | ||
expect(derived_process.inspect).to match(expected) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a neat update to the expect() clauses.
@@ -186,7 +186,7 @@ def run_command_and_stop(cmd, opts = {}) | |||
def type(input) | |||
return close_input if input == "\u0004" | |||
|
|||
last_command_started.write(input << "\n") | |||
last_command_started.write(input, "\n") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This probably needs to enumerate something like
input.times do |item|
last_command_started.write(item, "\n")
end
209f183
to
212c690
Compare
212c690
to
04fe34f
Compare
04fe34f
to
8fde296
Compare
Summary
Allow passing more than one string to
InProcess#write
andSpawnProcess#write
Details
Changes the arity of these two methods to match that of the base class' method. This makes these methods match the behavior of
IO#write
.Motivation and Context
This avoids the need to do a string append in
Api::Commands#type
, which in turn will help avoid issues when frozen strings are passed to that method. As a next step, all strings in Aruba can be made frozen by default.How Has This Been Tested?
Specs have been added
Types of changes
Checklist: