Skip to content

Commit 2efb765

Browse files
[DECO-531] Transition sync state to ERROR if the underlying sync process fails (#494)
1 parent e09a728 commit 2efb765

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

packages/databricks-vscode/src/cli/BricksTasks.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,9 @@ class CustomSyncTerminal implements Pseudoterminal {
8383
private writeEmitter = new EventEmitter<string>();
8484
onDidWrite: Event<string> = this.writeEmitter.event;
8585

86+
private closeEmitter = new EventEmitter<void>();
87+
onDidClose: Event<void> = this.closeEmitter.event;
88+
8689
private syncProcess: ChildProcess | undefined;
8790
private bricksSyncParser: BricksSyncParser;
8891

@@ -159,6 +162,14 @@ class CustomSyncTerminal implements Pseudoterminal {
159162
this.syncProcess.stdout.on("data", (data) => {
160163
this.bricksSyncParser.process(data.toString());
161164
});
165+
166+
this.syncProcess.on("close", (code) => {
167+
if (code !== 0) {
168+
this.syncStateCallback("ERROR");
169+
// terminate the vscode terminal task
170+
this.closeEmitter.fire();
171+
}
172+
});
162173
}
163174
}
164175

0 commit comments

Comments
 (0)