Livepush: Fix process not exiting on "Connection to device lost"

Resolves: #1828
Change-type: patch
This commit is contained in:
Paulo Castro 2020-11-07 23:42:48 +00:00
parent 309b1ba6a0
commit 5497835728
2 changed files with 12 additions and 0 deletions

View File

@ -274,6 +274,8 @@ export async function deployToDevice(opts: DeviceDeployOptions): Promise<void> {
globalLogger.logLivepush('Watching for file changes...');
globalLogger.outputDeferredMessages();
await Promise.all(promises);
livepush.close();
} else {
if (opts.detached) {
return;

View File

@ -290,6 +290,16 @@ export class LivepushManager {
return monitor;
}
public close() {
for (const container of Object.values(this.containers)) {
container.monitor.close().catch((err) => {
if (process.env.DEBUG) {
this.logger.logDebug(`chokidar.close() ${err.message}`);
}
});
}
}
public static preprocessDockerfile(content: string): string {
return new Dockerfile(content).generateLiveDockerfile();
}