Skip to content

Conversation

mvz
Copy link
Contributor

@mvz mvz commented May 30, 2019

Summary

Allow passing more than one string to InProcess#write and SpawnProcess#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

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Refactoring (cleanup of codebase without changing any existing functionality)
  • Update documentation

Checklist:

  • I've added tests for my code
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.

Copy link
Contributor

@olleolleolle olleolleolle left a 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.


def stderr(*)
NotImplementedError
raise NotImplementedError
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good fix!

end

# Write strint to stdin
# Write strings to stdin
Copy link
Contributor

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)
Copy link
Contributor

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.

return close_input if input == "\u0004"

last_command_started.write(input << "\n")
last_command_started.write(input, "\n")
Copy link
Contributor

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

@mvz mvz force-pushed the improve-process-write branch from 209f183 to 212c690 Compare January 4, 2020 09:47
@mvz mvz force-pushed the improve-process-write branch from 212c690 to 04fe34f Compare January 3, 2021 13:03
@mvz mvz force-pushed the improve-process-write branch from 04fe34f to 8fde296 Compare January 15, 2022 22:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants