From 2a9f04346d0f5b1a5add2f3066ca177f24b8c17c Mon Sep 17 00:00:00 2001 From: Umut Uzgur Date: Wed, 14 Aug 2019 09:37:44 +0200 Subject: [PATCH 1/3] fix: call destroy on finish to handle node bug --- lib/ios-deploy.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/ios-deploy.js b/lib/ios-deploy.js index ec852f572..40e2fb316 100644 --- a/lib/ios-deploy.js +++ b/lib/ios-deploy.js @@ -45,11 +45,11 @@ 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); } catch (e) { log.warn(`Couldn't get the application installed notification with ${APPLICATION_NOTIFICATION_TIMEOUT}ms but we will continue`); } @@ -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); } From 8350bc4c20d8602e4e363b2fcad4ae1c4748d0fb Mon Sep 17 00:00:00 2001 From: Umut Uzgur Date: Wed, 14 Aug 2019 10:03:44 +0200 Subject: [PATCH 2/3] fix: call destroy on finish to handle node bug --- lib/ios-deploy.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/ios-deploy.js b/lib/ios-deploy.js index 40e2fb316..15a1cc8fc 100644 --- a/lib/ios-deploy.js +++ b/lib/ios-deploy.js @@ -49,9 +49,9 @@ class IOSDeploy { try { await installationService.installApplication(bundlePathOnPhone, { PackageType: 'Developer'}); try { - await appInstalledNotification.timeout(APPLICATION_NOTIFICATION_TIMEOUT); + await appInstalledNotification.timeout(APPLICATION_NOTIFICATION_TIMEOUT, `Couldn't get the application installed notification with ${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(); From 51a07af2e995e12ddc4315e19773abd2b2c7c962 Mon Sep 17 00:00:00 2001 From: Umut Uzgur Date: Wed, 14 Aug 2019 10:04:20 +0200 Subject: [PATCH 3/3] fix: call destroy on finish to handle node bug --- lib/ios-deploy.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ios-deploy.js b/lib/ios-deploy.js index 15a1cc8fc..4aff6112f 100644 --- a/lib/ios-deploy.js +++ b/lib/ios-deploy.js @@ -49,7 +49,7 @@ class IOSDeploy { try { await installationService.installApplication(bundlePathOnPhone, { PackageType: 'Developer'}); try { - await appInstalledNotification.timeout(APPLICATION_NOTIFICATION_TIMEOUT, `Couldn't get the application installed notification with ${APPLICATION_NOTIFICATION_TIMEOUT}ms but we will continue`); + 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(`Failed to receive the notification. Error: ${e.message}`); }