File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -78,19 +78,20 @@ const stripChainspecJsonName = (chain: string) => {
7878 * @param chain
7979 */
8080const getChainspec = ( image : string , chain : string ) => {
81- let res ;
81+ const outputChainSpec = ` ${ shell . tempdir ( ) } / ${ chain } - ${ new Date ( ) . toISOString ( ) . slice ( 0 , 10 ) } .json` ;
8282 if ( chain . endsWith ( '.json' ) ) {
83- res = exec (
84- `docker run -v $(pwd)/${ chain } :/${ chain } --rm ${ image } build-spec --chain=/${ chain } --disable-default-bootnode`
83+ exec (
84+ `docker run -v $(pwd)/${ chain } :/${ chain } --rm ${ image } build-spec --chain=/${ chain } --disable-default-bootnode > ${ outputChainSpec } `
8585 ) ;
8686 } else {
87- res = exec ( `docker run --rm ${ image } build-spec --chain=${ chain } --disable-default-bootnode` ) ;
87+ exec ( `docker run --rm ${ image } build-spec --chain=${ chain } --disable-default-bootnode > ${ outputChainSpec } ` ) ;
8888 }
8989
9090 let spec ;
9191
9292 try {
93- spec = JSON . parse ( res . stdout ) ;
93+ spec = JSON . parse ( fs . readFileSync ( outputChainSpec ) . toString ( ) ) ;
94+ fs . unlinkSync ( outputChainSpec ) ;
9495 } catch ( e ) {
9596 return fatal ( 'build spec failed' , e ) ;
9697 }
You can’t perform that action at this time.
0 commit comments