diff --git a/lib/ios-deploy.js b/lib/ios-deploy.js index ec852f572..4aff6112f 100644 --- a/lib/ios-deploy.js +++ b/lib/ios-deploy.js @@ -45,13 +45,13 @@ class IOSDeploy { const installationService = await services.startInstallationProxyService(this.udid); const appInstalledNotification = new B((resolve) => { notificationService.observeNotification(APPLICATION_INSTALLED_NOTIFICATION, { notification: resolve }); - }).timeout(APPLICATION_NOTIFICATION_TIMEOUT); + }); try { await installationService.installApplication(bundlePathOnPhone, { PackageType: 'Developer'}); try { - await appInstalledNotification; + await appInstalledNotification.timeout(APPLICATION_NOTIFICATION_TIMEOUT, `Couldn't get the application installed notification within ${APPLICATION_NOTIFICATION_TIMEOUT}ms but we will continue`); } catch (e) { - log.warn(`Couldn't get the application installed notification with ${APPLICATION_NOTIFICATION_TIMEOUT}ms but we will continue`); + log.warn(`Failed to receive the notification. Error: ${e.message}`); } } finally { installationService.close(); @@ -72,6 +72,7 @@ class IOSDeploy { } else { const readStream = fs.createReadStream(itemPath, {autoClose: true}); const writeStream = await afcService.createWriteStream(pathOnPhone, {autoDestroy: true }); + writeStream.on('finish', writeStream.destroy); promises.push(new B((resolve) => writeStream.on('close', resolve))); readStream.pipe(writeStream); }