Skip to content
Permalink
Browse files

refactor(generic): use cross-spawn-promise instead of spawn-rx

  • Loading branch information
malept committed Sep 23, 2017
1 parent eafbb70 commit 5a9848c7afc122cbbc2f1fcabbe2cd903a133d76
Showing with 12 additions and 18 deletions.
  1. +0 −1 package.json
  2. +2 −2 src/installers/darwin/dmg.js
  3. +4 −9 src/installers/darwin/zip.js
  4. +2 −2 src/makers/win32/appx.js
  5. +2 −2 src/util/hdiutil.js
  6. +2 −2 src/util/yarn-or-npm.js
@@ -129,7 +129,6 @@
"resolve-package": "^1.0.1",
"s3": "^4.4.0",
"semver": "^5.3.0",
"spawn-rx": "^2.0.7",
"sudo-prompt": "^7.0.0",
"tabtab": "^2.2.1",
"username": "^3.0.0",
@@ -1,4 +1,4 @@
import { spawn } from 'child_process';
import spawnPromise from 'cross-spawn-promise';
import fs from 'fs-extra';
import path from 'path';

@@ -24,7 +24,7 @@ export default async (filePath, installSpinner) => {

await moveApp(appPath, targetApplicationPath, installSpinner, true);

spawn('open', ['-R', targetApplicationPath], { detached: true });
await spawnPromise('open', ['-R', targetApplicationPath], { detached: true });
} finally {
await unmountImage(targetMount);
}
@@ -1,16 +1,11 @@
import { spawn } from 'child_process';
import spawnPromise from 'cross-spawn-promise';
import fs from 'fs-extra';
import path from 'path';
import moveApp from '../../util/move-app';

export default async (filePath, installSpinner) => {
await new Promise((resolve) => {
const child = spawn('unzip', ['-q', '-o', path.basename(filePath)], {
cwd: path.dirname(filePath),
});
child.stdout.on('data', () => {});
child.stderr.on('data', () => {});
child.on('exit', () => resolve());
await spawnPromise('unzip', ['-q', '-o', path.basename(filePath)], {
cwd: path.dirname(filePath),
});

const appPath = (await fs.readdir(path.dirname(filePath))).filter(file => file.endsWith('.app'))
@@ -21,5 +16,5 @@ export default async (filePath, installSpinner) => {

await moveApp(appPath, targetApplicationPath, installSpinner);

spawn('open', ['-R', targetApplicationPath], { detached: true });
await spawnPromise('open', ['-R', targetApplicationPath], { detached: true });
};
@@ -4,7 +4,7 @@ import parseAuthor from 'parse-author';
import windowsStore from 'electron-windows-store';
import { isValidPublisherName, makeCert } from 'electron-windows-store/lib/sign';

import { findActualExecutable } from 'spawn-rx';
import resolveCommand from 'cross-spawn/lib/util/resolveCommand';
import { ensureDirectory } from '../../util/ensure-output';
import configFn from '../../util/config-fn';

@@ -22,7 +22,7 @@ const windowsSdkPath = process.arch === 'x64' ?
function findSdkTool(exe) {
let sdkTool = path.join(windowsSdkPath, exe);
if (!fs.existsSync(sdkTool)) {
sdkTool = findActualExecutable(exe, []).cmd;
sdkTool = resolveCommand(exe, true);
}

if (!fs.existsSync(sdkTool)) {
@@ -1,4 +1,4 @@
import { spawnPromise } from 'spawn-rx';
import spawnPromise from 'cross-spawn-promise';
import debug from 'debug';

const d = debug('electron-forge:hdiutil');
@@ -26,7 +26,7 @@ export const getMountedImages = async () => {

export const mountImage = async (filePath) => {
d('mounting image:', filePath);
const output = await spawnPromise('hdiutil', ['attach', '-noautoopen', '-nobrowse', '-noverify', filePath]);
const output = await spawnPromise('hdiutil', ['attach', '-noautoopen', '-nobrowse', '-noverify', filePath]).toString();
const mountPath = /\/Volumes\/(.+)\n/g.exec(output)[1];
d('mounted at:', mountPath);

@@ -1,4 +1,4 @@
import crossSpawn from 'cross-spawn-promise';
import spawnPromise from 'cross-spawn-promise';
import logSymbols from 'log-symbols';
import yarnOrNpm from 'yarn-or-npm';

@@ -18,6 +18,6 @@ const safeYarnOrNpm = () => {

export default safeYarnOrNpm;

export const yarnOrNpmSpawn = (...args) => crossSpawn(safeYarnOrNpm(), ...args);
export const yarnOrNpmSpawn = (...args) => spawnPromise(safeYarnOrNpm(), ...args);

export const hasYarn = () => safeYarnOrNpm() === 'yarn';

0 comments on commit 5a9848c

Please sign in to comment.
You can’t perform that action at this time.