Skip to content

Commit

Permalink
Fix childProcess logging for real
Browse files Browse the repository at this point in the history
  • Loading branch information
cdupuis committed Aug 22, 2018
1 parent 49b12a2 commit e119aa5
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 27 deletions.
38 changes: 18 additions & 20 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"@atomist/sdm": "*"
},
"devDependencies": {
"@atomist/automation-client": "^0.21.2",
"@atomist/automation-client": "^0.21.4",
"@atomist/sdm": "^0.4.3",
"@types/lodash": "^4.14.116",
"@types/mocha": "^5.2.5",
Expand Down
14 changes: 8 additions & 6 deletions src/internal/delivery/build/local/SpawnBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ export class SpawnBuilder extends LocalBuilder implements LogInterpretation {
const errorFinder = this.options.errorFinder;
logger.info("%s.startBuild on %s, buildCommands=[%j] or file=[%s]", this.name, id.url, this.options.commands,
this.options.commandFile);
return this.sdm.configuration.sdm.projectLoader.doWithProject({credentials, id, readOnly: true}, async p => {
return this.sdm.configuration.sdm.projectLoader.doWithProject({ credentials, id, readOnly: true }, async p => {
const commands: SpawnCommand[] = this.options.commands || await loadCommandsFromFile(p, this.options.commandFile);

const appId: AppInfo = await this.options.projectToAppInfo(p);
Expand All @@ -142,7 +142,7 @@ export class SpawnBuilder extends LocalBuilder implements LogInterpretation {
logger.info("Enriching options from project %s:%s", p.id.owner, p.id.repo);
optionsToUse = await this.options.enrich(optionsToUse, p);
}
const opts = _.merge({cwd: p.baseDir}, optionsToUse);
const opts = _.merge({ cwd: p.baseDir }, optionsToUse);

function executeOne(buildCommand: SpawnCommand): Promise<ChildProcessResult> {
return spawnAndWatch(buildCommand,
Expand All @@ -156,7 +156,7 @@ export class SpawnBuilder extends LocalBuilder implements LogInterpretation {
if (br.error) {
const message = "Stopping build commands due to error on " + stringifySpawnCommand(buildCommand);
log.write(message);
return {error: true, code: br.code, message};
return { error: true, code: br.code, message, childProcess: undefined };
}
return br;
});
Expand All @@ -169,9 +169,11 @@ export class SpawnBuilder extends LocalBuilder implements LogInterpretation {
if (br.error) {
throw new Error("Build failure: " + br.error);
}
log.write("---");
log.write(`Result: ${JSON.stringify({ ...br, childProcess: undefined })}`);
log.write("---");
const r = {
...br,
};
delete r.childProcess;
log.write(`---\nResult: ${JSON.stringify(r)}\n---`);
return executeOne(buildCommand);
});
}
Expand Down

0 comments on commit e119aa5

Please sign in to comment.