File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import * as fs from 'fs' ;
2+ import * as https from 'https' ;
3+ import * as child_process from 'child_process' ;
4+
5+ describe ( 'temp tests' , async ( ) => {
6+ it ( 'downloads and forks from s3' , ( done ) => {
7+ fs . mkdirSync ( '/Library/Caches/codify/plugins' , { recursive : true } )
8+
9+ //fs.writeFileSync('/Library/Caches/codify/plugins/core-plugin.js', '')
10+ const file = fs . createWriteStream ( '/Library/Caches/codify/plugins/core-plugin.js' )
11+
12+ file . on ( 'open' , ( ) => {
13+ https . get ( 'https://codify-plugin-library.s3.amazonaws.com/codify-core/index.js' , ( res ) => {
14+ res . pipe ( file )
15+ } )
16+ } )
17+
18+ file . on ( 'finish' , async ( ) => {
19+ file . close ( )
20+ console . log ( 'Download complete' )
21+
22+ console . log ( 'Starting child_process' )
23+ const child = child_process . fork ( '/Library/Caches/codify/plugins/core-plugin.js' )
24+ child . send ( {
25+ cmd : 'plan' ,
26+ data : {
27+ type : 'abc' ,
28+ name : 'nae'
29+ }
30+ } )
31+
32+ let sleep = async ms => new Promise ( resolve => setTimeout ( resolve , ms ) ) ;
33+ await sleep ( 5000 )
34+
35+ done ( )
36+ } )
37+ } )
38+ } )
Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ import { PluginMessage } from './entities/message';
77type Resolve = ( value : unknown ) => void ;
88type Reject = ( reason ?: Error ) => void ;
99
10- const resultFunctionName = ( cmd : string ) => `${ cmd } Result ` ;
10+ const resultFunctionName = ( cmd : string ) => `${ cmd } _Result ` ;
1111
1212export class PluginIpcBridge {
1313 process : ChildProcess ;
You can’t perform that action at this time.
0 commit comments