Skip to content

Commit 998e631

Browse files
feat: allow to set the cwd in copyToPod for use in tar
1 parent 6aa7539 commit 998e631

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/cp.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,20 +59,23 @@ export class Cp {
5959
* @param {string} containerName - The name of the container in the pod to exec the command inside.
6060
* @param {string} srcPath - The source path in local
6161
* @param {string} tgtPath - The target path in the pod
62+
* @param {string} cwd - The directory that is used as the parent when uploading
6263
*/
6364
public async cpToPod(
6465
namespace: string,
6566
podName: string,
6667
containerName: string,
6768
srcPath: string,
6869
tgtPath: string,
70+
cwd?: string,
6971
): Promise<void> {
7072
const tmpFile = tmp.fileSync();
7173
const tmpFileName = tmpFile.name;
7274
const command = ['tar', 'xf', '-', '-C', tgtPath];
7375
await tar.c(
7476
{
7577
file: tmpFile.name,
78+
cwd,
7679
},
7780
[srcPath],
7881
);

0 commit comments

Comments
 (0)