Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Build: avoid process leak when generating website (#9217)
  • Loading branch information
not-an-aardvark authored and ilyavolodin committed Sep 3, 2017
1 parent cb74b87 commit bdec46d
Showing 1 changed file with 17 additions and 12 deletions.
29 changes: 17 additions & 12 deletions Makefile.js
Expand Up @@ -3,7 +3,7 @@
* @author nzakas
*/

/* global cat, cd, cp, echo, exec, exit, find, ls, mkdir, pwd, rm, target, test*/
/* global target */
/* eslint no-use-before-define: "off", no-console: "off" */
"use strict";

Expand All @@ -24,10 +24,24 @@ const lodash = require("lodash"),
os = require("os"),
path = require("path"),
semver = require("semver"),
shell = require("shelljs"),
ejs = require("ejs"),
loadPerf = require("load-perf"),
yaml = require("js-yaml");

const cat = shell.cat;
const cd = shell.cd;
const cp = shell.cp;
const echo = shell.echo;
const exec = shell.exec;
const exit = shell.exit;
const find = shell.find;
const ls = shell.ls;
const mkdir = shell.mkdir;
const pwd = shell.pwd;
const rm = shell.rm;
const test = shell.test;

//------------------------------------------------------------------------------
// Settings
//------------------------------------------------------------------------------
Expand Down Expand Up @@ -146,7 +160,7 @@ function generateRulesIndex(basedir) {
* @returns {string} The result of the executed command.
*/
function execSilent(cmd) {
return exec(cmd, { silent: true }).output;
return exec(cmd, { silent: true }).stdout;
}

/**
Expand Down Expand Up @@ -329,7 +343,7 @@ function getFirstCommitOfFile(filePath) {
* @param {string} filePath The file path to check.
* @returns {string} The tag name.
*/
function getTagOfFirstOccurrence(filePath) {
function getFirstVersionOfFile(filePath) {
const firstCommit = getFirstCommitOfFile(filePath);
let tags = execSilent(`git tag --contains ${firstCommit}`);

Expand All @@ -343,15 +357,6 @@ function getTagOfFirstOccurrence(filePath) {
}, []).sort(semver.compare)[0];
}

/**
* Gets the version number where a given file was introduced first.
* @param {string} filePath The file path to check.
* @returns {string} The version number.
*/
function getFirstVersionOfFile(filePath) {
return getTagOfFirstOccurrence(filePath);
}

/**
* Gets the commit that deleted a file.
* @param {string} filePath The path to the deleted file.
Expand Down

0 comments on commit bdec46d

Please sign in to comment.