Skip to content

Commit a648c90

Browse files
fix: build command
1 parent afe9374 commit a648c90

File tree

2 files changed

+12
-19
lines changed

2 files changed

+12
-19
lines changed

lib/utils/command.js

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ const commit = (pushDir) => __awaiter(this, void 0, void 0, function* () {
5656
const push = (pushDir, branch, context) => __awaiter(this, void 0, void 0, function* () {
5757
signale_1.default.info('Pushing to %s@%s', misc_1.getRepository(context), branch);
5858
const url = misc_1.getGitUrl(context);
59-
yield execAsync(`git -C ${pushDir} push --quiet "${url}" "${branch}":"${branch}"`, true, 'git push');
59+
yield execAsync(`git -C ${pushDir} push --quiet "${url}" "${branch}":"${branch}"`, false, 'git push');
6060
});
6161
const cloneForBuild = (buildDir, context) => __awaiter(this, void 0, void 0, function* () {
6262
signale_1.default.info('Cloning the working commit from the remote repo for build');
@@ -91,22 +91,18 @@ const copyFiles = (buildDir, pushDir) => __awaiter(this, void 0, void 0, functio
9191
yield execAsync(`rsync -rl --exclude .git --delete "${buildDir}/" ${pushDir}`);
9292
});
9393
const execAsync = (command, quiet = false, altCommand = null, suppressError = false) => new Promise((resolve, reject) => {
94-
if (quiet && 'string' === typeof altCommand)
94+
if ('string' === typeof altCommand)
9595
signale_1.default.info(`Run command: ${altCommand}`);
9696
if (!quiet)
9797
signale_1.default.info(`Run command: ${command}`);
9898
child_process_1.exec(command + (quiet ? ' > /dev/null 2>&1' : '') + (suppressError ? ' || :' : ''), (error, stdout) => {
9999
if (error) {
100-
if (quiet) {
101-
console.log(stdout);
102-
console.log(error.message);
103-
if ('string' === typeof altCommand)
104-
reject(new Error(`command [${altCommand}] exited with code ${error.code}.`));
105-
else
106-
reject(new Error(`command exited with code ${error.code}.`));
107-
}
108-
else
100+
if ('string' === typeof altCommand)
101+
reject(new Error(`command [${altCommand}] exited with code ${error.code}.`));
102+
else if (!quiet)
109103
reject(new Error(`command [${command}] exited with code ${error.code}.`));
104+
else
105+
reject(new Error(`command exited with code ${error.code}.`));
110106
}
111107
else {
112108
if (!quiet)

src/utils/command.ts

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ const push = async (pushDir: string, branch: string, context: Context) => {
5555
signale.info('Pushing to %s@%s', getRepository(context), branch);
5656

5757
const url = getGitUrl(context);
58-
await execAsync(`git -C ${pushDir} push --quiet "${url}" "${branch}":"${branch}"`, true, 'git push');
58+
await execAsync(`git -C ${pushDir} push --quiet "${url}" "${branch}":"${branch}"`, false, 'git push');
5959
};
6060

6161
const cloneForBuild = async (buildDir: string, context: Context) => {
@@ -97,16 +97,13 @@ const copyFiles = async (buildDir: string, pushDir: string) => {
9797
};
9898

9999
const execAsync = (command: string, quiet: boolean = false, altCommand: string | null = null, suppressError: boolean = false) => new Promise<string>((resolve, reject) => {
100-
if (quiet && 'string' === typeof altCommand) signale.info(`Run command: ${altCommand}`);
100+
if ('string' === typeof altCommand) signale.info(`Run command: ${altCommand}`);
101101
if (!quiet) signale.info(`Run command: ${command}`);
102102
exec(command + (quiet ? ' > /dev/null 2>&1' : '') + (suppressError ? ' || :' : ''), (error, stdout) => {
103103
if (error) {
104-
if (quiet) {
105-
console.log(stdout);
106-
console.log(error.message);
107-
if ('string' === typeof altCommand) reject(new Error(`command [${altCommand}] exited with code ${error.code}.`));
108-
else reject(new Error(`command exited with code ${error.code}.`));
109-
} else reject(new Error(`command [${command}] exited with code ${error.code}.`));
104+
if ('string' === typeof altCommand) reject(new Error(`command [${altCommand}] exited with code ${error.code}.`));
105+
else if (!quiet) reject(new Error(`command [${command}] exited with code ${error.code}.`));
106+
else reject(new Error(`command exited with code ${error.code}.`));
110107
} else {
111108
if (!quiet) console.log(stdout);
112109
resolve(stdout);

0 commit comments

Comments
 (0)