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

@@ -114,7 +114,7 @@
"@types/redux-devtools-extension": "^2.13.2", "@types/redux-devtools-extension": "^2.13.2",
"@types/redux-mock-store": "^1.0.1", "@types/redux-mock-store": "^1.0.1",
"@types/rsocket-tcp-server": "^0.0.2", "@types/rsocket-tcp-server": "^0.0.2",
"@types/which": "^1.3.1", "@types/which": "^1.3.2",
"JSONStream": "^1.3.1", "JSONStream": "^1.3.1",
"adbkit": "^2.11.1", "adbkit": "^2.11.1",
"adbkit-logcat": "^2.0.1", "adbkit-logcat": "^2.0.1",

View File

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

View File

@@ -1460,10 +1460,10 @@
dependencies: dependencies:
"@types/node" "*" "@types/node" "*"
"@types/which@^1.3.1": "@types/which@^1.3.2":
version "1.3.1" version "1.3.2"
resolved "https://registry.yarnpkg.com/@types/which/-/which-1.3.1.tgz#7802c380887986ca909008afea4e08025b130f8d" resolved "https://registry.yarnpkg.com/@types/which/-/which-1.3.2.tgz#9c246fc0c93ded311c8512df2891fb41f6227fdf"
integrity sha512-ZrJDWpvg75LTGX4XwuneY9s6bF3OeZcGTpoGh3zDV9ytzcHMFsRrMIaLBRJZQMBoGyKs6unBQfVdrLZiYfb1zQ== integrity sha512-8oDqyLC7eD4HM307boe2QWKyuzdzWBj56xI/imSl2cpL+U3tCMaTAkMJ4ee5JBZ/FsOJlvRGeIShiZDAl1qERA==
"@types/yargs-parser@*": "@types/yargs-parser@*":
version "13.1.0" version "13.1.0"