@@ -71,7 +71,7 @@ export const requireFork = (modulePath: string, args: string[], builtInExtension
7171 }
7272} ;
7373
74- export const requireModule = ( modulePath : string , builtInExtensionsDir : string ) : void => {
74+ export const requireModule = ( modulePath : string , dataDir : string , builtInExtensionsDir : string ) : void => {
7575 process . env . AMD_ENTRYPOINT = modulePath ;
7676 const xml = require ( "xhr2" ) ;
7777 xml . XMLHttpRequest . prototype . _restrictedHeaders [ "user-agent" ] = false ;
@@ -96,7 +96,7 @@ export const requireModule = (modulePath: string, builtInExtensionsDir: string):
9696 */
9797 // tslint:disable-next-line:no-any
9898 ( < any > cp ) . fork = ( modulePath : string , args : ReadonlyArray < string > = [ ] , options ?: cp . ForkOptions ) : cp . ChildProcess => {
99- return cp . spawn ( process . execPath , [ "--fork" , modulePath , "--args" , JSON . stringify ( args ) ] , {
99+ return cp . spawn ( process . execPath , [ "--fork" , modulePath , "--args" , JSON . stringify ( args ) , "--data-dir" , dataDir ] , {
100100 ...options ,
101101 stdio : [ null , null , null , "ipc" ] ,
102102 } ) ;
@@ -123,7 +123,7 @@ export const requireModule = (modulePath: string, builtInExtensionsDir: string):
123123 * cp.stderr.on("data", (data) => console.log(data.toString("utf8")));
124124 * @param modulePath Path of the VS Code module to load.
125125 */
126- export const forkModule = ( modulePath : string , args : string [ ] , options : cp . ForkOptions ) : cp . ChildProcess => {
126+ export const forkModule = ( modulePath : string , args : string [ ] , options : cp . ForkOptions , dataDir ?: string ) : cp . ChildProcess => {
127127 let proc : cp . ChildProcess ;
128128 const forkArgs = [ "--bootstrap-fork" , modulePath ] ;
129129 if ( args ) {
@@ -134,6 +134,9 @@ export const forkModule = (modulePath: string, args: string[], options: cp.ForkO
134134 delete options . env . ELECTRON_RUN_AS_NODE ;
135135 forkArgs . push ( "--env" , JSON . stringify ( options . env ) ) ;
136136 }
137+ if ( dataDir ) {
138+ forkArgs . push ( "--data-dir" , dataDir ) ;
139+ }
137140 const forkOptions : cp . ForkOptions = {
138141 stdio : [ null , null , null , "ipc" ] ,
139142 } ;
0 commit comments