mirror of
https://github.com/containers/podman.git
synced 2025-10-17 11:14:40 +08:00
export: use io.Writer instead of file
This allows use to use STDOUT directly without having to call open again, also this makes the export API endpoint much more performant since it no longer needs to copy to a temp file. I noticed that there was no export API test so I added one. And lastly opening /dev/stdout will not work on windows. Fixes #16870 Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
@ -462,7 +462,7 @@ func (c *Container) Unpause() error {
|
||||
|
||||
// Export exports a container's root filesystem as a tar archive
|
||||
// The archive will be saved as a file at the given path
|
||||
func (c *Container) Export(path string) error {
|
||||
func (c *Container) Export(out io.Writer) error {
|
||||
if !c.batched {
|
||||
c.lock.Lock()
|
||||
defer c.lock.Unlock()
|
||||
@ -477,7 +477,7 @@ func (c *Container) Export(path string) error {
|
||||
}
|
||||
|
||||
defer c.newContainerEvent(events.Mount)
|
||||
return c.export(path)
|
||||
return c.export(out)
|
||||
}
|
||||
|
||||
// AddArtifact creates and writes to an artifact file for the container
|
||||
|
Reference in New Issue
Block a user