Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: call destroy on finish to handle node bug #1040

Merged
merged 3 commits into from
Aug 14, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions lib/ios-deploy.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

which argument writeStream.destroy is supposed to receive?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nothing since it ended properly

promises.push(new B((resolve) => writeStream.on('close', resolve)));
readStream.pipe(writeStream);
}
Expand Down