Skip to content

Commit 8769f6a

Browse files
authored
Merge pull request #943 from kubernetes-client/patch-2
Close the writestream before heading over to untar also read failure from status.
2 parents 1f76ee1 + 342738f commit 8769f6a

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/cp.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,9 @@ export class Cp {
4040
errStream,
4141
null,
4242
false,
43-
async () => {
44-
if (errStream.size()) {
43+
async ({ status }) => {
44+
writerStream.close();
45+
if (status === 'Failure' || errStream.size()) {
4546
throw new Error(`Error from cpFromPod - details: \n ${errStream.getContentsAsString()}`);
4647
}
4748
await tar.x({
@@ -86,8 +87,8 @@ export class Cp {
8687
errStream,
8788
readStream,
8889
false,
89-
async () => {
90-
if (errStream.size()) {
90+
async ({ status }) => {
91+
if (status === 'Failure' || errStream.size()) {
9192
throw new Error(`Error from cpToPod - details: \n ${errStream.getContentsAsString()}`);
9293
}
9394
},

0 commit comments

Comments
 (0)