{"action":"created","issue":{"url":"https://api.github.com/repos/ktbyers/netmiko/issues/223","repository_url":"https://api.github.com/repos/ktbyers/netmiko","labels_url":"https://api.github.com/repos/ktbyers/netmiko/issues/223/labels{/name}","comments_url":"https://api.github.com/repos/ktbyers/netmiko/issues/223/comments","events_url":"https://api.github.com/repos/ktbyers/netmiko/issues/223/events","html_url":"https://github.com/ktbyers/netmiko/issues/223","id":160289100,"number":223,"title":"send_command returns incomplete output","user":{"login":"lundybernard","id":17297695,"avatar_url":"https://avatars.githubusercontent.com/u/17297695?v=3","gravatar_id":"","url":"https://api.github.com/users/lundybernard","html_url":"https://github.com/lundybernard","followers_url":"https://api.github.com/users/lundybernard/followers","following_url":"https://api.github.com/users/lundybernard/following{/other_user}","gists_url":"https://api.github.com/users/lundybernard/gists{/gist_id}","starred_url":"https://api.github.com/users/lundybernard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lundybernard/subscriptions","organizations_url":"https://api.github.com/users/lundybernard/orgs","repos_url":"https://api.github.com/users/lundybernard/repos","events_url":"https://api.github.com/users/lundybernard/events{/privacy}","received_events_url":"https://api.github.com/users/lundybernard/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-06-14T21:32:25Z","updated_at":"2016-06-14T22:19:21Z","closed_at":null,"body":"ex: \r\n```python\r\ndevice = {'device_type':'cisco_ios'...\r\nshell = ConnectHandler(**device)\r\nshell.enable()\r\nout = shell.send_command(\"write memory\")\r\nprint(out)\r\n```\r\nreturns:\r\n>Building configuration...\r\n\r\nbut the full output should be:\r\n>Building configuration...\r\n>Compressed configuration from 543610 bytes to 149342 bytes[OK]\r\n\r\nI tried a bit of a hack-around like so:\r\n```python\r\nout = shell.send_command(self.args.cmd, max_loops=500)\r\nout += shell.read_until_prompt()\r\n```\r\nwhich returns:\r\n>Building configuration...\r\n>Compressed configuration from 543610 bytes to 149342 bytes[OK]\r\n>my_host#\r\n\r\nwith the prompt at the end.\r\n\r\nIs there a better way to collect all of the output from send_command before it returns, or is using a read_until method the correct solution?\r\nI guess i'm also a bit confused because \"show version\" returned a big multi-line block of output without any trouble."},"comment":{"url":"https://api.github.com/repos/ktbyers/netmiko/issues/comments/226033520","html_url":"https://github.com/ktbyers/netmiko/issues/223#issuecomment-226033520","issue_url":"https://api.github.com/repos/ktbyers/netmiko/issues/223","id":226033520,"user":{"login":"ktbyers","id":899716,"avatar_url":"https://avatars.githubusercontent.com/u/899716?v=3","gravatar_id":"","url":"https://api.github.com/users/ktbyers","html_url":"https://github.com/ktbyers","followers_url":"https://api.github.com/users/ktbyers/followers","following_url":"https://api.github.com/users/ktbyers/following{/other_user}","gists_url":"https://api.github.com/users/ktbyers/gists{/gist_id}","starred_url":"https://api.github.com/users/ktbyers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ktbyers/subscriptions","organizations_url":"https://api.github.com/users/ktbyers/orgs","repos_url":"https://api.github.com/users/ktbyers/repos","events_url":"https://api.github.com/users/ktbyers/events{/privacy}","received_events_url":"https://api.github.com/users/ktbyers/received_events","type":"User","site_admin":false},"created_at":"2016-06-14T22:19:21Z","updated_at":"2016-06-14T22:19:21Z","body":"Use\r\n\r\n```\r\nout = send_command_expect(\"write mem\")\r\n```\r\n\r\nThis is the preferred solution. I will probably convert send_command to be send_command_expect() in a future release (and retain send_command_expect so as not to break code that uses it). I will probably rename the current send_command, send_command_timing (or something similar)."}}
{"actor":{"display_login":"ktbyers"}}