Remove promisify use

Summary:
The results are often unpredictable, poorly typed and we have
dependencies that do the wrapping for us.

Listen, I'll get to writing some real code soon, I promise,
but I need to clean up my workspace first, okay?

Reviewed By: mweststrate

Differential Revision: D30247484

fbshipit-source-id: f5326ff71ff43af2dc64ab85ca1368f95fe87083
This commit is contained in:
Pascal Hartig
2021-08-11 11:02:10 -07:00
committed by Facebook GitHub Bot
parent 4e17fb9c48
commit a630020ea0

View File

@@ -12,11 +12,10 @@ import child_process, {ChildProcess} from 'child_process';
import BaseDevice from './BaseDevice';
import JSONStream from 'JSONStream';
import {Transform} from 'stream';
import fs from 'fs';
import fs from 'fs-extra';
import {v1 as uuid} from 'uuid';
import path from 'path';
import {promisify} from 'util';
import {exec} from 'child_process';
import {exec} from 'promisify-child-process';
import {default as promiseTimeout} from '../utils/promiseTimeout';
import {IOSBridge} from '../utils/IOSBridge';
import split2 from 'split2';
@@ -75,10 +74,11 @@ export default class IOSDevice extends BaseDevice {
this.deviceType === 'emulator'
? `xcrun simctl io ${this.serial} screenshot ${tmpFilePath}`
: `idb screenshot --udid ${this.serial} ${tmpFilePath}`;
return promisify(exec)(command)
.then(() => promisify(fs.readFile)(tmpFilePath))
.then((buffer) => {
return promisify(fs.unlink)(tmpFilePath).then(() => buffer);
return exec(command)
.then(() => fs.readFile(tmpFilePath))
.then(async (buffer) => {
await fs.unlink(tmpFilePath);
return buffer;
});
}