Upgrade which / simplify use

Summary:
It's already a promise. With the next upgrade this otherwise causes
some nasty type errors due to overloading.

Reviewed By: jknoxville

Differential Revision: D18059641

fbshipit-source-id: 93cee95d7bbf767ff6276a0946262bf83587c728
This commit is contained in:
Pascal Hartig
2019-10-23 05:50:19 -07:00
committed by Facebook Github Bot
parent 561d560e18
commit d54b341192
3 changed files with 6 additions and 9 deletions

View File

@@ -13,15 +13,12 @@ import {spawn} from 'child_process';
import {dirname} from 'path';
import {selectDevice, preferDevice} from '../reducers/connections';
import {default as which} from 'which';
import {promisify} from 'util';
import {showOpenDialog} from '../utils/exportData';
import PropTypes from 'prop-types';
import BaseDevice from '../devices/BaseDevice';
import React, {Component} from 'react';
import {State} from '../reducers';
const whichPromise = promisify(which);
type StateFromProps = {
selectedDevice: BaseDevice | null | undefined;
androidEmulators: Array<string>;
@@ -48,7 +45,7 @@ class DevicesButton extends Component<Props> {
launchEmulator = (name: string) => {
// On Linux, you must run the emulator from the directory it's in because
// reasons ...
whichPromise('emulator')
which('emulator')
.then(emulatorPath => {
if (emulatorPath) {
const child = spawn(emulatorPath, [`@${name}`], {