Skip to content

Commit

Permalink
fix(nx): increases buffer size for git commands
Browse files Browse the repository at this point in the history
increases buffer size to 10MB

fix #1886
  • Loading branch information
rpd10 authored and vsavkin committed Oct 1, 2019
1 parent 4b4a5dc commit adcd928
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import {
createBuilder,
BuilderContext,
BuilderOutput
BuilderOutput,
createBuilder
} from '@angular-devkit/architect';
import { Observable } from 'rxjs';
import { exec } from 'child_process';
import { JsonObject } from '@angular-devkit/core';
import { exec } from 'child_process';
import { Observable } from 'rxjs';
import { TEN_MEGABYTES } from '../../command-line/shared';

try {
require('dotenv').config();
Expand Down Expand Up @@ -136,7 +137,6 @@ function createProcess(
): Promise<boolean> {
command = transformCommand(command, parsedArgs);
return new Promise(res => {
const TEN_MEGABYTES = 1024 * 10000;
const childProcess = exec(command, { maxBuffer: TEN_MEGABYTES });
/**
* Ensure the child process is killed when the parent exits
Expand Down
8 changes: 6 additions & 2 deletions packages/workspace/src/command-line/shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ import { output } from './output';

const ignore = require('ignore');

export const TEN_MEGABYTES = 1024 * 10000;

export type ImplicitDependencyEntry = { [key: string]: '*' | string[] };
export type NormalizedImplicitDependencyEntry = { [key: string]: string[] };
export type ImplicitDependencies = {
Expand Down Expand Up @@ -141,7 +143,9 @@ function getUntrackedFiles(): string[] {
}

function getFilesUsingBaseAndHead(base: string, head: string): string[] {
const mergeBase = execSync(`git merge-base ${base} ${head}`)
const mergeBase = execSync(`git merge-base ${base} ${head}`, {
maxBuffer: TEN_MEGABYTES
})
.toString()
.trim();
return parseGitOutput(`git diff --name-only ${mergeBase} ${head}`);
Expand All @@ -152,7 +156,7 @@ function getFilesFromShash(sha1: string, sha2: string): string[] {
}

function parseGitOutput(command: string): string[] {
return execSync(command)
return execSync(command, { maxBuffer: TEN_MEGABYTES })
.toString('utf-8')
.split('\n')
.map(a => a.trim())
Expand Down

0 comments on commit adcd928

Please sign in to comment.