|
1 | 1 | ///<reference path="../.d.ts"/>
|
2 | 2 | "use strict";
|
3 | 3 |
|
| 4 | +import * as child_process from "child_process"; |
4 | 5 | import * as path from "path";
|
5 | 6 | import * as shell from "shelljs";
|
6 | 7 | import * as constants from "../constants";
|
@@ -486,24 +487,18 @@ export class PlatformService implements IPlatformService {
|
486 | 487 |
|
487 | 488 | if (this.$options.availableDevices) {
|
488 | 489 | return (() => {
|
489 |
| - let exec = require("child_process").exec; |
| 490 | + let callback = (error: Error, stdout: Buffer, stderr: Buffer) => { |
| 491 | + if (error !== null) { |
| 492 | + this.$errors.fail(error); |
| 493 | + } else { |
| 494 | + this.$logger.info(stdout); |
| 495 | + } |
| 496 | + }; |
490 | 497 |
|
491 | 498 | if (this.$mobileHelper.isiOSPlatform(platform)) {
|
492 |
| - exec("instruments -s devices", (error: Error, stdout: string, stderr: string) => { |
493 |
| - if (error !== null) { |
494 |
| - this.$errors.fail(error); |
495 |
| - } else { |
496 |
| - this.$logger.info(stdout); |
497 |
| - } |
498 |
| - }); |
| 499 | + child_process.exec("instruments -s devices", callback); |
499 | 500 | } else if (this.$mobileHelper.isAndroidPlatform(platform)) {
|
500 |
| - exec("android list avd", (error: Error, stdout: string, stderr: string) => { |
501 |
| - if (error !== null) { |
502 |
| - this.$errors.fail(error); |
503 |
| - } else { |
504 |
| - this.$logger.info(stdout); |
505 |
| - } |
506 |
| - }); |
| 501 | + child_process.exec("android list avd", callback); |
507 | 502 | }
|
508 | 503 | }).future<void>()();
|
509 | 504 | } else {
|
|
0 commit comments