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

Allow send() to skip appending newline at the end. #25

Closed
wants to merge 2 commits into from

Conversation

mzagozen
Copy link

Sometimes, you only want to send a control character (Ctrl-C) without a newline.

This PR adds a new optional newline boolean parameter to the send() method to override the default behavior.

@coveralls
Copy link

coveralls commented Jun 14, 2017

Coverage Status

Coverage decreased (-0.7%) to 99.185% when pulling e93579b on mzagozen:master into dda719f on fgimian:master.

@coveralls
Copy link

coveralls commented Jun 14, 2017

Coverage Status

Coverage decreased (-0.3%) to 99.638% when pulling 11560db on mzagozen:master into dda719f on fgimian:master.

@mzagozen
Copy link
Author

This is odd. I added a test case that works on my machine, but fails in travis.
I'm running the tests locally with pytest -s --cov paramiko_expect --cov-report term-missing.

Any ideas @fgimian?

@mzagozen mzagozen closed this Sep 28, 2017
"""Saves and sends the send string provided."""
self.current_send_string = send_string
self.channel.send(send_string + self.newline)
Copy link
Collaborator

Choose a reason for hiding this comment

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

I would suggest doing this a bit diffrent
something like

def send(self, send_string, newline=None):
    newline = newline if newline else self.newline
    self.current_send_string = send_string
    self.channel.send(send_string + newline)

@fruch
Copy link
Collaborator

fruch commented Sep 28, 2017

@mzagozen thanks for you input
please see my comments

as for testing in CI, what did you expect to happen ?

@fruch fruch reopened this Sep 28, 2017
@fruch
Copy link
Collaborator

fruch commented Sep 30, 2017

after looking into the CI jobs, it's not your fault it was failing the docker image I was using there was renamed, I'll deliver a fix to master soon...

@fruch fruch closed this Sep 30, 2017
fruch added a commit that referenced this pull request Sep 30, 2017
* Allow send() to skip appending newline at the end.

* Cover skipping newline in tests.

* cleanup the send() newline, and add it as new test
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.

None yet

3 participants