Skip to content

Commit 6cf9434

Browse files
committed
Quiet tracers
1 parent 4c39148 commit 6cf9434

File tree

5 files changed

+19
-18
lines changed

5 files changed

+19
-18
lines changed

src/backend/common/util.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import path from 'path';
44
import fs from 'fs-extra';
55
import removeMarkdown from 'remove-markdown';
66

7-
const execute = (command, cwd, { stdout = process.stdout, stderr = process.stderr } = {}) => new Promise((resolve, reject) => {
8-
const child = child_process.exec(command, { cwd }, (error, stdout, stderr) => {
7+
const execute = (command, { stdout = process.stdout, stderr = process.stderr, ...options } = {}) => new Promise((resolve, reject) => {
8+
const child = child_process.exec(command, options, (error, stdout, stderr) => {
99
if (error) return reject(error.code ? new Error(stderr) : error);
1010
resolve(stdout);
1111
});

src/backend/controllers/algorithms.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ const router = express.Router();
99

1010
const downloadCategories = () => (
1111
fs.pathExistsSync(hierarchy.path) ?
12-
execute(`git fetch && git reset --hard origin/master`, hierarchy.path) :
13-
execute(`git clone https://github.com/algorithm-visualizer/algorithms.git ${hierarchy.path}`, __dirname)
12+
execute(`git fetch && git reset --hard origin/master`, { cwd: hierarchy.path }) :
13+
execute(`git clone https://github.com/algorithm-visualizer/algorithms.git ${hierarchy.path}`)
1414
).then(() => hierarchy.refresh());
1515

1616
downloadCategories().catch(console.error);

src/backend/controllers/tracers.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ const trace = lang => (req, res, next) => {
3232
`-m=${memoryLimit}m`,
3333
'-e ALGORITHM_VISUALIZER=1',
3434
builder.imageName,
35-
].join(' ')).catch(error => {
35+
].join(' '), { stdout: null, stderr: null }).catch(error => {
3636
if (killed) throw new Error('Time Limit Exceeded');
3737
throw error;
3838
}).finally(() => clearTimeout(timer));

src/backend/models/Hierarchy.js

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -40,19 +40,20 @@ class Hierarchy {
4040

4141
cacheContributors(files, commitAuthors) {
4242
return Promise.each(files, file => {
43-
return execute(`git --no-pager log --follow --no-merges --format="%H" "${file.path}"`, this.path, { stdout: null })
44-
.then(stdout => {
45-
const output = stdout.toString().replace(/\n$/, '');
46-
const shas = output.split('\n').reverse();
47-
const contributors = [];
48-
for (const sha of shas) {
49-
const author = commitAuthors[sha];
50-
if (author && !contributors.find(contributor => contributor.login === author.login)) {
51-
contributors.push(author);
52-
}
43+
return execute(`git --no-pager log --follow --no-merges --format="%H" "${file.path}"`, {
44+
cwd: this.path, stdout: null,
45+
}).then(stdout => {
46+
const output = stdout.toString().replace(/\n$/, '');
47+
const shas = output.split('\n').reverse();
48+
const contributors = [];
49+
for (const sha of shas) {
50+
const author = commitAuthors[sha];
51+
if (author && !contributors.find(contributor => contributor.login === author.login)) {
52+
contributors.push(author);
5353
}
54-
file.contributors = contributors;
55-
});
54+
}
55+
file.contributors = contributors;
56+
});
5657
});
5758
}
5859

src/backend/tracers/ImageBuilder.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class ImageBuilder {
1212

1313
build(release) {
1414
const { tag_name } = release;
15-
return execute(`docker build -t ${this.imageName} . --build-arg tag_name=${tag_name}`, this.directory);
15+
return execute(`docker build -t ${this.imageName} . --build-arg tag_name=${tag_name}`, { cwd: this.directory });
1616
}
1717
}
1818

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy