Skip to content

Commit

Permalink
Merge pull request #24 from MarZab/master
Browse files Browse the repository at this point in the history
docker cli stdin option
  • Loading branch information
mattqs authored Dec 10, 2021
2 parents 8c19c20 + b3ba777 commit 4244948
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ export const dockerCommand = async (
echo: true,
env: undefined,
machineName: undefined,
stdin: undefined
},
) => {
let machineconfig = "";
Expand Down Expand Up @@ -216,6 +217,11 @@ export const dockerCommand = async (
},
);

if (options.stdin) {
childProcess.stdin.write(options.stdin);
childProcess.stdin.end();
}

if (options.echo) {
childProcess.stdout.on("data", (chunk) => {
process.stdout.write(chunk.toString());
Expand All @@ -240,6 +246,7 @@ export class Docker {
echo: true,
env: undefined,
machineName: undefined,
stdin: undefined
},
) {}

Expand All @@ -253,6 +260,7 @@ export interface IOptions {
currentWorkingDirectory?: string;
echo?: boolean;
env?: NodeJS.ProcessEnv;
stdin?: string;
}

export class Options implements IOptions {
Expand All @@ -261,5 +269,6 @@ export class Options implements IOptions {
public currentWorkingDirectory?: string,
public echo: boolean = true,
public env?: NodeJS.ProcessEnv,
public stdin?: string,
) {}
}

0 comments on commit 4244948

Please sign in to comment.