Skip to content

Commit

Permalink
Just use bash keyword, git bash for windows doesn't need to use EXE_PATH
Browse files Browse the repository at this point in the history
  • Loading branch information
firecow committed Feb 28, 2021
1 parent 309a8dc commit fc19022
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
6 changes: 3 additions & 3 deletions src/job.ts
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ export class Job {
cmd += `${script}\n`;
});
const cp = childProcess.spawn(cmd, {
shell: Utils.getShell(),
shell: 'bash',
stdio: ['inherit', 'inherit', 'inherit'],
cwd: this.cwd,
});
Expand All @@ -301,7 +301,7 @@ export class Job {
process.stdout.write(`${this.getJobNameString()} ${magentaBright('pulled')} in ${magenta(prettyHrtime(endTime))}\n`);

let dockerCmd = ``;
dockerCmd += `docker run -u 0:0 -d -i -w /builds/ ${this.image} `;
dockerCmd += `docker run -u 0:0 -d -i -w //builds/ ${this.image} `;
dockerCmd += `sh -c "\n`
dockerCmd += `if [ -x /usr/local/bin/bash ]; then\n`
dockerCmd += `\texec /usr/local/bin/bash \n`;
Expand Down Expand Up @@ -332,7 +332,7 @@ export class Job {
}

const cp = childProcess.spawn(this.containerId ? `docker attach ${this.containerId}` : `bash -e`, {
shell: Utils.getShell(),
shell: 'bash',
stdio: ['pipe', 'pipe', 'pipe'],
cwd: this.cwd,
});
Expand Down
6 changes: 1 addition & 5 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export class Utils {

static spawn(command: string, cwd = process.cwd(), env: { [key: string]: string | undefined } = process.env): Promise<{ stdout: string, stderr: string, output: string, status: number }> {
return new Promise((resolve, reject) => {
const cp = childProcess.spawn(command, {shell: Utils.getShell(), env, cwd});
const cp = childProcess.spawn(command, {shell: 'bash', env, cwd});

let output = '';
let stdout = '';
Expand All @@ -33,10 +33,6 @@ export class Utils {
});
}

static getShell() {
return process.env.EXE_PATH ? `${process.env.EXE_PATH}/bash.exe` : `bash`;
}

static printJobNames(job: { name: string }, i: number, arr: { name: string }[]) {
if (i === arr.length - 1) {
process.stdout.write(`${blueBright(`${job.name}`)}`);
Expand Down

0 comments on commit fc19022

Please sign in to comment.