Skip to content

Commit 92185b0

Browse files
committed
fix(message): Change the way pact-message is invoked which should avoid some issues in Windows environments
1 parent 481639f commit 92185b0

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/message.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ const checkTypes = require('check-types');
1313
export class Message {
1414
public readonly options: MessageOptions;
1515
private readonly __argMapping = {
16-
content: DEFAULT_ARG,
1716
pactFileWriteMode: DEFAULT_ARG,
1817
dir: '--pact_dir',
1918
consumer: '--consumer',
@@ -82,7 +81,7 @@ export class Message {
8281
public createMessage(): q.Promise<unknown> {
8382
logger.info(`Creating message pact`);
8483
const deferred = q.defer();
85-
const { pactFileWriteMode, ...restOptions } = this.options;
84+
const { pactFileWriteMode, content, ...restOptions } = this.options;
8685

8786
const instance = spawn.spawnBinary(
8887
pactStandalone.messagePath,
@@ -92,6 +91,7 @@ export class Message {
9291
const output: Array<string | Buffer> = [];
9392
instance.stdout.on('data', l => output.push(l));
9493
instance.stderr.on('data', l => output.push(l));
94+
instance.stdin.write(content);
9595
instance.once('close', code => {
9696
const o = output.join('\n');
9797
logger.info(o);
@@ -103,6 +103,8 @@ export class Message {
103103
}
104104
});
105105

106+
instance.stdin.end();
107+
106108
return deferred.promise;
107109
}
108110
}

0 commit comments

Comments
 (0)