Skip to content

Commit 4244948

Browse files
authored
Merge pull request #24 from MarZab/master
docker cli stdin option
2 parents 8c19c20 + b3ba777 commit 4244948

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/index.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@ export const dockerCommand = async (
176176
echo: true,
177177
env: undefined,
178178
machineName: undefined,
179+
stdin: undefined
179180
},
180181
) => {
181182
let machineconfig = "";
@@ -216,6 +217,11 @@ export const dockerCommand = async (
216217
},
217218
);
218219

220+
if (options.stdin) {
221+
childProcess.stdin.write(options.stdin);
222+
childProcess.stdin.end();
223+
}
224+
219225
if (options.echo) {
220226
childProcess.stdout.on("data", (chunk) => {
221227
process.stdout.write(chunk.toString());
@@ -240,6 +246,7 @@ export class Docker {
240246
echo: true,
241247
env: undefined,
242248
machineName: undefined,
249+
stdin: undefined
243250
},
244251
) {}
245252

@@ -253,6 +260,7 @@ export interface IOptions {
253260
currentWorkingDirectory?: string;
254261
echo?: boolean;
255262
env?: NodeJS.ProcessEnv;
263+
stdin?: string;
256264
}
257265

258266
export class Options implements IOptions {
@@ -261,5 +269,6 @@ export class Options implements IOptions {
261269
public currentWorkingDirectory?: string,
262270
public echo: boolean = true,
263271
public env?: NodeJS.ProcessEnv,
272+
public stdin?: string,
264273
) {}
265274
}

0 commit comments

Comments
 (0)