@@ -8,6 +8,8 @@ var uniq = require('lodash.uniq')
88var inherits = require ( 'util' ) . inherits
99var Agent = require ( '../agent' )
1010
11+ var MAX_BUFFER = 1024 * 1024 // 1 mb
12+
1113function Security ( options ) {
1214 this . collectorApi = options . collectorApi
1315 Agent . call ( this , 'Security' )
@@ -48,7 +50,9 @@ Security.prototype.collectSnykFlags = function collectSnykFlags (callback) {
4850 return patch . split ( ':' ) [ 1 ]
4951 } )
5052
51- childProcess . execFile ( 'npm' , [ 'ls' ] . concat ( uniq ( packageNames ) ) . concat ( [ '--parseable' , '--long' ] ) , function ( _error , stdout , stderr ) {
53+ childProcess . execFile ( 'npm' , [ 'ls' ] . concat ( uniq ( packageNames ) ) . concat ( [ '--parseable' , '--long' ] ) , {
54+ maxBuffer : MAX_BUFFER
55+ } , function ( _error , stdout , stderr ) {
5256 if ( _error ) {
5357 // ignore
5458 debug . error ( 'collectSnykFlags' ,
@@ -110,9 +114,8 @@ Security.prototype.collectSnykFlags = function collectSnykFlags (callback) {
110114}
111115
112116Security . prototype . collectDependencies = function collectDependencies ( callback ) {
113- var maxBuffer = 10 * 1024 * 1024 // 10mb
114117 childProcess . execFile ( 'npm' , [ 'ls' , '--json' , '--production' ] , {
115- maxBuffer : maxBuffer
118+ maxBuffer : MAX_BUFFER
116119 } , function ( error , stdout , stderr ) {
117120 if ( error ) {
118121 // ignore
0 commit comments