From 4c47c766fdaeea63daefa72e015fee5264bea9bf Mon Sep 17 00:00:00 2001 From: Pascal Hartig Date: Tue, 29 Oct 2019 06:00:50 -0700 Subject: [PATCH] Fix installed plugin check Summary: D17877108 inadvertently introduced a bug because `fs` and `fs-extra` behave differently and apparently wrapping `exists` which is already async in another `promisify` ends up raising the result as an exception (in this case throwing "true" or "false" as an error instead of yielding it back). Annoyingly, TypeScript's type system doesn't catch this. :/ This fixes the invocation and restores the install/remove functionality. Reviewed By: jknoxville Differential Revision: D18199958 fbshipit-source-id: f5835d8912bfe1191a12a318103bfc1fb7d776a3 --- src/chrome/PluginInstaller.tsx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/chrome/PluginInstaller.tsx b/src/chrome/PluginInstaller.tsx index f32f71b3c..6303f9eb3 100644 --- a/src/chrome/PluginInstaller.tsx +++ b/src/chrome/PluginInstaller.tsx @@ -26,12 +26,10 @@ import { Tooltip, } from 'flipper'; import React, {useCallback, useState, useMemo, useEffect} from 'react'; -import {remote} from 'electron'; import {List} from 'immutable'; import algoliasearch from 'algoliasearch'; import path from 'path'; import fs from 'fs-extra'; -import {promisify} from 'util'; import {homedir} from 'os'; import {PluginManager as PM} from 'live-plugin-manager'; import {reportPlatformFailures, reportUsage} from '../utils/metrics'; @@ -368,7 +366,7 @@ function useNPMSearch( } async function _getInstalledPlugins(): Promise> { - const pluginDirExists = await promisify(fs.exists)(PLUGIN_DIR); + const pluginDirExists = await fs.pathExists(PLUGIN_DIR); if (!pluginDirExists) { return new Map();