{"action":"created","issue":{"url":"https://api.github.com/repos/gliderlabs/ssh/issues/35","repository_url":"https://api.github.com/repos/gliderlabs/ssh","labels_url":"https://api.github.com/repos/gliderlabs/ssh/issues/35/labels{/name}","comments_url":"https://api.github.com/repos/gliderlabs/ssh/issues/35/comments","events_url":"https://api.github.com/repos/gliderlabs/ssh/issues/35/events","html_url":"https://github.com/gliderlabs/ssh/issues/35","id":222539486,"number":35,"title":"Request for example","user":{"login":"literadix","id":799820,"avatar_url":"https://avatars1.githubusercontent.com/u/799820?v=3","gravatar_id":"","url":"https://api.github.com/users/literadix","html_url":"https://github.com/literadix","followers_url":"https://api.github.com/users/literadix/followers","following_url":"https://api.github.com/users/literadix/following{/other_user}","gists_url":"https://api.github.com/users/literadix/gists{/gist_id}","starred_url":"https://api.github.com/users/literadix/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/literadix/subscriptions","organizations_url":"https://api.github.com/users/literadix/orgs","repos_url":"https://api.github.com/users/literadix/repos","events_url":"https://api.github.com/users/literadix/events{/privacy}","received_events_url":"https://api.github.com/users/literadix/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2017-04-18T20:41:59Z","updated_at":"2017-04-19T07:54:36Z","closed_at":null,"body":"This is a great peace of software. Thank you very much. Could you please post an example how to write a client as go routine which is waiting for user input lines and which answers each lines after processing it? Thank you very much.\r\n\r\n```go\r\nssh.Handle(func(s ssh.Session) {\r\n\t\tlog.Printf(\"%s\", s.RemoteAddr())\r\n\t\tio.WriteString(s, fmt.Sprintf(\"Hello %s\\n\", s.User()))\r\n\r\n                // ... handle connection until it closes by user input, client close\r\n                // ??????\r\n\t})\r\n```\r\n\r\nThank you very much in advance.\r\n"},"comment":{"url":"https://api.github.com/repos/gliderlabs/ssh/issues/comments/295148114","html_url":"https://github.com/gliderlabs/ssh/issues/35#issuecomment-295148114","issue_url":"https://api.github.com/repos/gliderlabs/ssh/issues/35","id":295148114,"user":{"login":"literadix","id":799820,"avatar_url":"https://avatars1.githubusercontent.com/u/799820?v=3","gravatar_id":"","url":"https://api.github.com/users/literadix","html_url":"https://github.com/literadix","followers_url":"https://api.github.com/users/literadix/followers","following_url":"https://api.github.com/users/literadix/following{/other_user}","gists_url":"https://api.github.com/users/literadix/gists{/gist_id}","starred_url":"https://api.github.com/users/literadix/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/literadix/subscriptions","organizations_url":"https://api.github.com/users/literadix/orgs","repos_url":"https://api.github.com/users/literadix/repos","events_url":"https://api.github.com/users/literadix/events{/privacy}","received_events_url":"https://api.github.com/users/literadix/received_events","type":"User","site_admin":false},"created_at":"2017-04-19T07:54:36Z","updated_at":"2017-04-19T07:54:36Z","body":"Hello,\r\n\r\nI tried is with ssh.NoPty. This is also not working. I am using the standard ssh linux ssh client without any options. The code is now like this:\r\n\r\npackage main\r\n\r\nimport (\r\n\t\"bufio\"\r\n\t\"fmt\"\r\n\t\"io\"\r\n\t\"log\"\r\n\r\n\t\"github.com/gliderlabs/ssh\"\r\n)\r\n\r\nfunc main() {\r\n\tssh.Handle(func(s ssh.Session) {\r\n\r\n\t\tio.WriteString(s, \"Hello world\\n\")\r\n\t\tscanner := bufio.NewScanner(s)\r\n\t\tfmt.Println(\"1\")\r\n\r\n\t\tfor scanner.Scan() {\r\n\t\t\tfmt.Println(\"2\")\r\n\t\t\tfmt.Fprintln(s, \"got:\", scanner.Text())\r\n\t\t}\r\n\r\n\t})\r\n\r\n\tlog.Fatal(ssh.ListenAndServe(\":2222\", nil), ssh.NoPty())\r\n}\r\n\r\nIn my client I see \"Hello world\", on my program console I see just \"1\". It hangs redings lines from the client. \"2\" is not displayed.\r\n\r\n"}}
{"actor":{"display_login":"literadix"}}