From 36be36db813a989eec8a1908b639c6686dcf29e9 Mon Sep 17 00:00:00 2001 From: Joao Moreno Date: Wed, 4 Apr 2018 16:46:49 +0200 Subject: [PATCH] :lipstick: --- test/smoke2/src/code.ts | 42 ++++++++++++++++++----------------------- 1 file changed, 18 insertions(+), 24 deletions(-) diff --git a/test/smoke2/src/code.ts b/test/smoke2/src/code.ts index 3b65a83766d..041f9b0c42d 100644 --- a/test/smoke2/src/code.ts +++ b/test/smoke2/src/code.ts @@ -98,34 +98,28 @@ export async function connect(child: cp.ChildProcess, outPath: string, handlePat } } -export function spawn(options: SpawnOptions): Promise { +export async function spawn(options: SpawnOptions): Promise { const codePath = options.codePath; const electronPath = codePath ? getBuildElectronPath(codePath) : getDevElectronPath(); const outPath = codePath ? getBuildOutPath(codePath) : getDevOutPath(); + const handlePath = await new Promise((c, e) => tmpName((err, handlePath) => err ? e(err) : c(handlePath))); - return new Promise((c, e) => { - tmpName((err, handlePath) => { - if (err) { return e(err); } + const args = [ + '--skip-getting-started', + '--skip-release-notes', + '--sticky-quickopen', + '--disable-telemetry', + '--disable-updates', + '--disable-crash-reporter', + `--extensions-dir=${options.extensionsPath}`, + `--user-data-dir=${options.userDataDir}`, + '--driver', handlePath + ]; - const args = [ - '--skip-getting-started', - '--skip-release-notes', - '--sticky-quickopen', - '--disable-telemetry', - '--disable-updates', - '--disable-crash-reporter', - `--extensions-dir=${options.extensionsPath}`, - `--user-data-dir=${options.userDataDir}`, - '--driver', handlePath - ]; + if (!codePath) { + args.unshift(repoPath); + } - if (!codePath) { - args.unshift(repoPath); - } - - const child = cp.spawn(electronPath, args); - - connect(child, outPath, handlePath).then(c, e); - }); - }); + const child = cp.spawn(electronPath, args); + return connect(child, outPath, handlePath); } \ No newline at end of file