From b90200e2aad68dd7ab1913b53cb71298e6041b3d Mon Sep 17 00:00:00 2001 From: Pascal Hartig Date: Mon, 9 Sep 2019 07:03:00 -0700 Subject: [PATCH] Replace child-process promise version Summary: This one is in TS, so we get types for free. `promisify` makes it rather awkward to work with overloaded functions like `spawn`, so there's still value in having a proper library for this. Reviewed By: jknoxville Differential Revision: D17204471 fbshipit-source-id: 3d07edfe2bb8c1e4c4f3134b53a0c4a0d9be383b --- package.json | 1 + src/devices/AndroidDevice.tsx | 6 ++++-- yarn.lock | 9 ++++++++- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index d3b9a895d..66d9f7b57 100644 --- a/package.json +++ b/package.json @@ -120,6 +120,7 @@ "openssl-wrapper": "^0.3.4", "pkg": "^4.3.7", "promise-retry": "^1.1.1", + "promisify-child-process": "^3.1.1", "prop-types": "^15.6.0", "query-string": "^6.2.0", "react": "16.8.6", diff --git a/src/devices/AndroidDevice.tsx b/src/devices/AndroidDevice.tsx index 0372194e6..bda4a8c76 100644 --- a/src/devices/AndroidDevice.tsx +++ b/src/devices/AndroidDevice.tsx @@ -8,7 +8,7 @@ import BaseDevice, {DeviceType, DeviceShell, LogLevel} from './BaseDevice'; import {Priority} from 'adbkit-logcat-fb'; import child_process from 'child_process'; -import child_process_promise from 'child-process-es6-promise'; +import promisify_child_process from 'promisify-child-process'; import ArchivedDevice from './ArchivedDevice'; import {ReadStream} from 'fs'; @@ -82,7 +82,9 @@ export default class AndroidDevice extends BaseDevice { clearLogs(): Promise { this.logEntries = []; - return child_process_promise.spawn('adb', ['logcat', '-c']); + return promisify_child_process + .spawn('adb', ['logcat', '-c']) + .then(_ => undefined); } archive(): ArchivedDevice { diff --git a/yarn.lock b/yarn.lock index f215db7a5..9d64e2701 100644 --- a/yarn.lock +++ b/yarn.lock @@ -704,7 +704,7 @@ pirates "^4.0.0" source-map-support "^0.5.9" -"@babel/runtime@^7.0.0", "@babel/runtime@^7.1.2", "@babel/runtime@^7.4.2", "@babel/runtime@^7.4.5": +"@babel/runtime@^7.0.0", "@babel/runtime@^7.1.2", "@babel/runtime@^7.1.5", "@babel/runtime@^7.4.2", "@babel/runtime@^7.4.5": version "7.5.5" resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.5.5.tgz#74fba56d35efbeca444091c7850ccd494fd2f132" integrity sha512-28QvEGyQyNkB0/m2B4FU7IEZGK2NUrcMtT6BZEFALTguLk+AUT6ofsHtPk5QyjAdUkpMJ+/Em+quwz4HOt30AQ== @@ -6970,6 +6970,13 @@ promise@^7.1.1: dependencies: asap "~2.0.3" +promisify-child-process@^3.1.1: + version "3.1.1" + resolved "https://registry.yarnpkg.com/promisify-child-process/-/promisify-child-process-3.1.1.tgz#3a029c1d97bdb8bbcc8862c765b91f1cee0f2691" + integrity sha512-683UHZEP4Bm75BvBujEe87AdE9lxnoWpcU5pEw4FG9HCSwwZC9pF7HUj3QmlDAvhyvulkWHLZs1lVRBNTvkbXQ== + dependencies: + "@babel/runtime" "^7.1.5" + prompts@^2.0.1: version "2.1.0" resolved "https://registry.yarnpkg.com/prompts/-/prompts-2.1.0.tgz#bf90bc71f6065d255ea2bdc0fe6520485c1b45db"