Skip to content

Commit

Permalink
lint(transform): debug logging for shell tx
Browse files Browse the repository at this point in the history
  • Loading branch information
ssube committed Jan 1, 2020
1 parent d648c4c commit c652587
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/transform/ShellTransform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export class ShellTransform extends BaseTransform<ShellTransformData> implements

public async transform(entity: FilterValue, type: string, body: TemplateScope): Promise<TemplateScope> {
// execute command and collect stdout
this.logger.debug({ child: this.data.child }, 'executing shell command');
const child = this.exec(this.data.child.command, {
timeout: this.data.child.timeout,
});
Expand All @@ -35,10 +36,12 @@ export class ShellTransform extends BaseTransform<ShellTransformData> implements

// turn value into string
const value = JSON.stringify(entity);
this.logger.debug({ value }, 'writing value to shell command');
await writeValue(child.stdin, value);

// abort on errors
const results = await waitForChild(child);
this.logger.debug(results, 'collected results from shell command');

// parse stdout into output scope
return JSON.parse(results.stdout);
Expand Down

0 comments on commit c652587

Please sign in to comment.