(n uint64)
| 379 | } |
| 380 | |
| 381 | func (t *TarPipe) initReadFrom(n uint64) { |
| 382 | t.reader, t.outStream = io.Pipe() |
| 383 | options := &exec.ExecOptions{ |
| 384 | StreamOptions: exec.StreamOptions{ |
| 385 | IOStreams: genericiooptions.IOStreams{ |
| 386 | In: nil, |
| 387 | Out: t.outStream, |
| 388 | ErrOut: t.o.Out, |
| 389 | }, |
| 390 | |
| 391 | Namespace: t.src.PodNamespace, |
| 392 | PodName: t.src.PodName, |
| 393 | }, |
| 394 | |
| 395 | Command: []string{"tar", "cf", "-", t.src.File.String()}, |
| 396 | Executor: t.o.Executor, |
| 397 | } |
| 398 | if t.o.MaxTries != 0 { |
| 399 | escapedPath := strings.ReplaceAll(t.src.File.String(), "'", `'\''`) |
| 400 | options.Command = []string{"sh", "-c", fmt.Sprintf("tar cf - '%s' | tail -c+%d", escapedPath, n)} |
| 401 | } |
| 402 | |
| 403 | go func() { |
| 404 | defer t.outStream.Close() |
| 405 | cmdutil.CheckErr(t.o.execute(options)) |
| 406 | }() |
| 407 | } |
| 408 | |
| 409 | func (t *TarPipe) Read(p []byte) (n int, err error) { |
| 410 | n, err = t.reader.Read(p) |
no test coverage detected