Skip to content

Commit 8bace24

Browse files
Merge pull request #214 from pcoop/branch1
Reduced screen refreshing
2 parents 83a9b26 + 83eb8f1 commit 8bace24

File tree

1 file changed

+10
-18
lines changed

1 file changed

+10
-18
lines changed

src/api/BundlePush/BundlePusher.ts

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -130,14 +130,9 @@ export class BundlePusher {
130130
// Run 'npm install' for each package.json file that exists in the bundle
131131
await this.runAllNpmInstalls(sshSession, packageJsonFiles);
132132

133-
// Run DFHDPLOY to install the bundle
134-
const deployMessages = await this.deployBundle(zosMFSession, bd, cicsSession, bundle);
133+
// Run DFHDPLOY to install the bundle (note that this will end the progress bar)
134+
await this.deployBundle(zosMFSession, bd, cicsSession, bundle);
135135

136-
// Complete the progress bar
137-
this.progressBar.percentComplete = TaskProgress.ONE_HUNDRED_PERCENT;
138-
this.endProgressBar();
139-
140-
this.issueMessage(deployMessages);
141136
return "PUSH operation completed";
142137
}
143138

@@ -205,13 +200,11 @@ export class BundlePusher {
205200
}
206201

207202
private issueMessage(msg: string) {
208-
this.endProgressBar();
209203
this.params.response.console.log(Buffer.from(msg));
210204
if (this.params.arguments.silent === undefined) {
211205
const logger = Logger.getAppLogger();
212206
logger.warn(msg);
213207
}
214-
this.startProgressBar();
215208
}
216209

217210
private validateProfiles(zosmfProfile: IProfile, sshProfile: IProfile, cicsProfile: IProfile) {
@@ -345,7 +338,7 @@ export class BundlePusher {
345338
}
346339

347340
private async deployBundle(zosMFSession: AbstractSession, bd: BundleDeployer,
348-
cicsSession: AbstractSession, bundle: Bundle): Promise<string> {
341+
cicsSession: AbstractSession, bundle: Bundle) {
349342
// End the current progress bar so that DEPLOY can create its own
350343
this.updateStatus("Deploying bundle '" + this.params.arguments.name + "' to CICS");
351344
const subtask = new SubtaskWithStatus(this.progressBar, TaskProgress.THIRTY_PERCENT);
@@ -362,15 +355,15 @@ export class BundlePusher {
362355
}
363356
dfhdployOutput = bd.getJobOutput();
364357

365-
// Resume the current progress bar
358+
// End the main progress bar
359+
this.progressBar.percentComplete = TaskProgress.ONE_HUNDRED_PERCENT;
366360
this.endProgressBar();
367361
if (deployError === undefined) {
368362
this.updateStatus("Deploy complete");
369363
}
370364
else {
371365
this.updateStatus("Deploy ended with errors");
372366
}
373-
this.startProgressBar();
374367

375368
// Collect general information about the regions in the CICSplex scope
376369
let deployMessages = await this.generateGeneralDiagnostics(cicsSession);
@@ -379,14 +372,13 @@ export class BundlePusher {
379372
deployMessages += await this.generateNodejsSpecificDiagnostics(cicsSession);
380373
}
381374

375+
// Report any console messages now
376+
this.issueMessage(deployMessages);
377+
382378
// Now rethrow the original error, if there was one.
383379
if (deployError !== undefined) {
384-
// If we're going to throw an error then report any messages now
385-
this.issueMessage(deployMessages);
386380
throw deployError;
387381
}
388-
389-
return deployMessages;
390382
}
391383

392384
private sshOutput(data: string) {
@@ -756,10 +748,10 @@ export class BundlePusher {
756748
let stdout = outputRecord.stdout;
757749
let stderr = outputRecord.stderr;
758750

759-
if (stdout === "") {
751+
if (stdout === undefined || stdout.trim() === "") {
760752
stdout = "<not available>";
761753
}
762-
if (stderr === "") {
754+
if (stderr === undefined || stderr.trim() === "") {
763755
stderr = "<not available>";
764756
}
765757

0 commit comments

Comments
 (0)