Skip to content
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

Use frozen_string_literal in class Command #2

Merged
merged 1 commit into from
May 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/progeny/command.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
module Progeny
# Progeny::Command includes logic for executing child processes and
# reading/writing from their standard input, output, and error streams. It's
Expand Down Expand Up @@ -228,7 +229,7 @@ def exec!
# exceeds the amount specified by the max argument.
def read_and_write(input, stdin, stdout, stderr, timeout=nil, max=nil)
max = nil if max && max <= 0
@out, @err = '', ''
@out, @err = +'', +''
Copy link
Author

Choose a reason for hiding this comment

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

+@: Returns a string that is not frozen: self, if not frozen; self.dup otherwise.

https://ruby-doc.org/3.2.2/String.html#class-String-label-Methods+for+a+Frozen-2FUnfrozen+String


# force all string and IO encodings to BINARY under 1.9 for now
if @out.respond_to?(:force_encoding) and stdin.respond_to?(:set_encoding)
Expand Down
Loading