Skip to content

Commit

Permalink
Merge pull request #309 from barretlee/master
Browse files Browse the repository at this point in the history
Fixbug: increase the stdout/stderr buffer of exec
  • Loading branch information
joaomoreno committed Feb 18, 2019
2 parents bd00be7 + f9d5555 commit 883921b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/npm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ function checkNPM(cancellationToken?: CancellationToken): Promise<void> {

function getNpmDependencies(cwd: string): Promise<string[]> {
return checkNPM()
.then(() => exec('npm list --production --parseable --depth=99999', { cwd }))
.then(() => exec('npm list --production --parseable --depth=99999', { cwd, maxBuffer: 5000 * 1024 }))
.then(({ stdout }) => stdout
.split(/[\r\n]/)
.filter(dir => path.isAbsolute(dir)));
Expand Down Expand Up @@ -149,7 +149,7 @@ function selectYarnDependencies(deps: YarnDependency[], packagedDependencies: st
}

async function getYarnProductionDependencies(cwd: string, packagedDependencies?: string[]): Promise<YarnDependency[]> {
const raw = await new Promise<string>((c, e) => cp.exec('yarn list --prod --json', { cwd, encoding: 'utf8', env: { ...process.env } }, (err, stdout) => err ? e(err) : c(stdout)));
const raw = await new Promise<string>((c, e) => cp.exec('yarn list --prod --json', { cwd, encoding: 'utf8', env: { ...process.env }, maxBuffer: 5000 * 1024 }, (err, stdout) => err ? e(err) : c(stdout)));
const match = /^{"type":"tree".*$/m.exec(raw);

if (!match || match.length !== 1) {
Expand Down
4 changes: 2 additions & 2 deletions src/package.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ interface IReadFile {
const readFile = denodeify<string, string, string>(fs.readFile);
const unlink = denodeify<string, void>(fs.unlink as any);
const stat = denodeify(fs.stat);
const exec = denodeify<string, { cwd?: string; env?: any; }, { stdout: string; stderr: string; }>(cp.exec as any, (err, stdout, stderr) => [err, { stdout, stderr }]);
const exec = denodeify<string, { cwd?: string; env?: any; maxBuffer?: number; }, { stdout: string; stderr: string; }>(cp.exec as any, (err, stdout, stderr) => [err, { stdout, stderr }]);
const glob = denodeify<string, _glob.Options, string[]>(_glob);

const resourcesPath = path.join(path.dirname(__dirname), 'resources');
Expand Down Expand Up @@ -824,7 +824,7 @@ function prepublish(cwd: string, manifest: Manifest): Promise<Manifest> {

console.warn(`Executing prepublish script 'npm run vscode:prepublish'...`);

return exec('npm run vscode:prepublish', { cwd })
return exec('npm run vscode:prepublish', { cwd, maxBuffer: 5000 * 1024 })
.then(({ stdout, stderr }) => {
process.stdout.write(stdout);
process.stderr.write(stderr);
Expand Down

0 comments on commit 883921b

Please sign in to comment.