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

Minimal changes to restore compatibility with SSHKit master (log_command_* methods) #18

Closed
wants to merge 4 commits into from

Conversation

mattbrictson
Copy link
Owner

@robd I based this off of #13 and then added the minimum amount of changes to make the code compatible with SSHKit master. The important changes are in 24343d6.

Do you agree this is a good stopgap solution?

robd and others added 4 commits May 25, 2015 10:50
Add support for the new log_command_* methods with minimal changes to the
existing Formatter code. This is done by decorating the Command object to
make it behave like the legacy version that has stderr/stdout methods, filled
with the data passed to log_command_data.

The other trick is that to avoid calling @log_file_formatter.write within the
legacy code, I use a disabling_log_file method to temporarily "mute" the
@log_file_formatter within a block.

This commit is intended as a stopgap to restore compatibility with with
SSHKit @ master until more serious refactoring can be done.
@robd
Copy link
Contributor

robd commented May 30, 2015

I think it's possible to do this by calling write_command directly - this removed the need for the disabling_log_file workaround. I thought it would be easier to just show you what I mean rather than trying to describe in a comment, so I created #19.

One small thing to note is that the stdout/stderr accessors are still available on Command, they are just deprecated. But I think the wrapper here and the additional .public_send("#{stream_type}=", line) are probably cleaner than trying to dynamically rewrite the accessors on Command.

Hope this helps!

@mattbrictson
Copy link
Owner Author

Closed in favor of #19.

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.

2 participants