File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -103,12 +103,16 @@ export class Client {
103103 const pprofDir = config . get < string > ( "pprofDir" ) ;
104104 const pprofArgs = pprofDir ? [ "--pprofDir" , pprofDir ] : [ ] ;
105105
106- // Get goMemLimit
107106 const goMemLimit = config . get < string > ( "goMemLimit" ) ;
108- const env = goMemLimit ? { ...process . env , GOMEMLIMIT : goMemLimit } : process . env ;
109107 if ( goMemLimit ) {
108+ // Keep this regex aligned with the pattern in package.json.
109+ if ( ! / ^ [ 0 - 9 ] + [ K M G T ] i B $ / . test ( goMemLimit ) ) {
110+ throw new Error ( "Invalid goMemLimit. Must be a valid memory limit (e.g., '2048MiB', '4GiB')." ) ;
111+ }
110112 this . outputChannel . appendLine ( `Setting GOMEMLIMIT=${ goMemLimit } ` ) ;
111113 }
114+ const env = goMemLimit ? { ...process . env , GOMEMLIMIT : goMemLimit } : process . env ;
115+
112116
113117 const serverOptions : ServerOptions = {
114118 run : {
You can’t perform that action at this time.
0 commit comments