GitHub PullRequestReviewCommentEvent at 2014-03-26 19:17:50
Repository: fleet
Actor: unihorn
Payload: {"comment":{"url":"https://api.github.com/repos/coreos/fleet/pulls/comments/10993737","id":10993737,"diff_hunk":"@@ -44,32 +48,64 @@ func journalAction(c *cli.Context) {\n \t\tsyscall.Exit(1)\n \t}\n \n-\taddr := fmt.Sprintf(\"%s:22\", js.MachineState.PublicIP)\n+\tcmd := fmt.Sprintf(\"journalctl -u %s --no-pager -l -n %d\", jobName, c.Int(\"lines\"))\n+\tif c.Bool(\"follow\") {\n+\t\tcmd += \" -f\"\n+\t}\n \n+\t// check if the job is running on this machine\n+\tvar out *bufio.Reader\n \tvar err error\n+\tif machine.IsLocalMachineState(js.MachineState) {\n+\t\tout = runLocalCommand(cmd)\n+\t} else {\n+\t\tout, err = runRemoteCommand(cmd, js.MachineState.PublicIP)\n+\t\tif err != nil {\n+\t\t\tlog.Fatalf(\"Unable to run command over SSH: %v\", err)\n+\t\t}\n+\t}\n+\n+\treadAllLines(out)\n+}\n+\n+func runLocalCommand(cmd string) *bufio.Reader {\n+\tcmdSlice := strings.Split(cmd, \" \")\n+\tosCmd := exec.Command(cmdSlice[0], cmdSlice[1:]...)\n+\tstdout, _ := osCmd.StdoutPipe()\n+\tbstdout := bufio.NewReader(stdout)\n+\n+\tosCmd.Start()\n+\tgo osCmd.Wait()","path":"fleetctl/journal.go","position":50,"original_position":50,"commit_id":"3bc2a98fee3ed197b75b86191505a67663e3ce44","original_commit_id":"3bc2a98fee3ed197b75b86191505a67663e3ce44","user":{"login":"unihorn","id":2976232,"avatar_url":"https://avatars.githubusercontent.com/u/2976232?","gravatar_id":"852ff8664759d24ac7609ce9ffe9d651","url":"https://api.github.com/users/unihorn","html_url":"https://github.com/unihorn","followers_url":"https://api.github.com/users/unihorn/followers","following_url":"https://api.github.com/users/unihorn/following{/other_user}","gists_url":"https://api.github.com/users/unihorn/gists{/gist_id}","starred_url":"https://api.github.com/users/unihorn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/unihorn/subscriptions","organizations_url":"https://api.github.com/users/unihorn/orgs","repos_url":"https://api.github.com/users/unihorn/repos","events_url":"https://api.github.com/users/unihorn/events{/privacy}","received_events_url":"https://api.github.com/users/unihorn/received_events","type":"User","site_admin":false},"body":"`Wait` may do some clean-garbage operations, and close stdoutpipe.\r\nIt is as the same here:\r\nhttps://github.com/coreos/fleet/blob/master/ssh/ssh.go#L55","created_at":"2014-03-26T19:17:50Z","updated_at":"2014-03-26T19:17:50Z","html_url":"https://github.com/coreos/fleet/pull/239#discussion_r10993737","pull_request_url":"https://api.github.com/repos/coreos/fleet/pulls/239","_links":{"self":{"href":"https://api.github.com/repos/coreos/fleet/pulls/comments/10993737"},"html":{"href":"https://github.com/coreos/fleet/pull/239#discussion_r10993737"},"pull_request":{"href":"https://api.github.com/repos/coreos/fleet/pulls/239"}}}}