diff --git a/spread/client.go b/spread/client.go index c72d48ab..8f5d1ab6 100644 --- a/spread/client.go +++ b/spread/client.go @@ -657,7 +657,7 @@ func (c *Client) RecvTar(packDir string, include []string, tar io.Writer) error var stderr safeBuffer session.Stdout = tar session.Stderr = &stderr - cmd := fmt.Sprintf(`cd '%s' && %s/bin/tar cJ --sort=name --ignore-failed-read -- %s`, packDir, c.sudo(), strings.Join(args, " ")) + cmd := fmt.Sprintf(`%s/bin/tar -C %q -cJ --sort=name --ignore-failed-read -- %s`, c.sudo(), packDir, strings.Join(args, " ")) err = c.runCommand(session, cmd, nil, &stderr) if err != nil { return outputErr(stderr.Bytes(), err)