import {resolve} from 'path';
import {invokeJar, log, greeting} from '../../util';
import logServiceError from './logServiceError';
import killServiceWhenKillCurrent from './killServiceWhenKillCurrent';

function serviceBuildPromise(service) {
    return new Promise(resolve => {
        service.stdout.on('data', data => {
            if (~data.indexOf('built')) {
                setTimeout(()=>{
                    resolve();
                }, 200);
            }
        });
    });
}

function createService(options) {
    const jarFile = resolve(__dirname, '../../../lib/Fast-FTL.jar');
    // console.log(options)
    return invokeJar(jarFile, [options]);
}

/**
 * root
 * port
 */
export default function (options) {
    const service = createService(JSON.stringify(options));
    killServiceWhenKillCurrent(service);
    logServiceError(service);
    return serviceBuildPromise(service);
};

@@ -390,62 +390,15 @@
 out(
-()=%3E%7B%0A                    resolve();%0A                %7D
+resolve
 , 20
@@ -543,37 +543,8 @@
 ar')
-;%0A    // console.log(options)
 %0A   
@@ -571,23 +571,39 @@
 rFile, %5B
+JSON.stringify(
 options
+)
 %5D);%0A%7D%0A%0A/
@@ -695,39 +695,24 @@
 Service(
-JSON.stringify(
 options)
 );%0A    k
@@ -703,17 +703,16 @@
 options)
-)
 ;%0A    ki

Update create.js