Make iOSContainerUtility strict
Summary: _typescript_ Reviewed By: jknoxville Differential Revision: D17259181 fbshipit-source-id: 5167be6cbf23b42d0f79246dae22f4e4a9417339
This commit is contained in:
committed by
Facebook Github Bot
parent
b90200e2aa
commit
a29f2c3b10
@@ -4,9 +4,9 @@
|
|||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
* @format
|
* @format
|
||||||
*/
|
*/
|
||||||
import {promisify} from 'util';
|
|
||||||
import {DeviceType} from '../devices/BaseDevice';
|
import {DeviceType} from '../devices/BaseDevice';
|
||||||
const exec = promisify(require('child_process').exec);
|
import promisify_child_process from 'promisify-child-process';
|
||||||
|
import {notNull} from '../utils/typeUtils';
|
||||||
|
|
||||||
const errorMessage = 'Physical iOS devices not yet supported';
|
const errorMessage = 'Physical iOS devices not yet supported';
|
||||||
|
|
||||||
@@ -20,38 +20,40 @@ function isAvailable(): boolean {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function targets(): Promise<Array<DeviceTarget>> {
|
async function targets(): Promise<Array<DeviceTarget>> {
|
||||||
return exec('instruments -s devices').then(({stdout}) =>
|
const {stdout} = await promisify_child_process.exec('instruments -s devices');
|
||||||
stdout
|
if (!stdout) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
return stdout
|
||||||
.toString()
|
.toString()
|
||||||
.split('\n')
|
.split('\n')
|
||||||
.map(line => line.trim())
|
.map(line => line.trim())
|
||||||
.map(line => /(.+) \([^(]+\) \[(.*)\]( \(Simulator\))?/.exec(line))
|
.map(line => /(.+) \([^(]+\) \[(.*)\]( \(Simulator\))?/.exec(line))
|
||||||
.filter(Boolean)
|
.filter(notNull)
|
||||||
.filter(
|
.filter(
|
||||||
([match, name, udid, isSim]) =>
|
([_match, name, _udid, isSim]) =>
|
||||||
!isSim && (name.includes('iPhone') || name.includes('iPad')),
|
!isSim && (name.includes('iPhone') || name.includes('iPad')),
|
||||||
)
|
)
|
||||||
.map(([match, name, udid]) => {
|
.map(([_match, name, udid]) => {
|
||||||
return {udid: udid, type: 'physical', name: name};
|
return {udid: udid, type: 'physical', name: name};
|
||||||
}),
|
});
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function push(
|
function push(
|
||||||
udid: string,
|
_udid: string,
|
||||||
src: string,
|
_src: string,
|
||||||
bundleId: string,
|
_bundleId: string,
|
||||||
dst: string,
|
_dst: string,
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
return Promise.reject(errorMessage);
|
return Promise.reject(errorMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
function pull(
|
function pull(
|
||||||
udid: string,
|
_udid: string,
|
||||||
src: string,
|
_src: string,
|
||||||
bundleId: string,
|
_bundleId: string,
|
||||||
dst: string,
|
_dst: string,
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
return Promise.reject(errorMessage);
|
return Promise.reject(errorMessage);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user