本文整理匯總了Golang中github.com/cloudfoundry-incubator/garden-linux/linux_container.LinuxContainer.StreamOut方法的典型用法代碼示例。如果您正苦於以下問題:Golang LinuxContainer.StreamOut方法的具體用法?Golang LinuxContainer.StreamOut怎麽用?Golang LinuxContainer.StreamOut使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/cloudfoundry-incubator/garden-linux/linux_container.LinuxContainer
的用法示例。
在下文中一共展示了LinuxContainer.StreamOut方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1:
"/some/directory",
"dst",
},
}
fakeRunner.WhenRunning(
cmdSpec,
func(cmd *exec.Cmd) error {
_, err := cmd.Stdout.Write([]byte("the-compressed-content"))
Expect(err).ToNot(HaveOccurred())
return nil
},
)
reader, err := container.StreamOut(garden.StreamOutSpec{
User: "alice",
Path: "/some/directory/dst",
})
Expect(err).ToNot(HaveOccurred())
bytes, err := ioutil.ReadAll(reader)
Expect(err).ToNot(HaveOccurred())
Expect(string(bytes)).To(Equal("the-compressed-content"))
Expect(fakeRunner).To(HaveBackgrounded(cmdSpec))
})
Context("when no user specified", func() {
It("streams the output of tar as root", func() {
cmdSpec := fake_command_runner.CommandSpec{
Path: containerDir + "/bin/nstar",
Args: []string{