Skip to content

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

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

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,17 @@ export class SyncTask extends Task {
5454
this.group = TaskGroup.Build;
5555
this.presentationOptions.reveal = TaskRevealKind.Silent;
5656
}
57+
58+
static killAll() {
59+
let found: boolean = false;
60+
window.terminals.forEach((terminal) => {
61+
if (terminal.name === "sync") {
62+
found = true;
63+
terminal.dispose();
64+
}
65+
});
66+
return found;
67+
}
5768
}
5869

5970
/**
@@ -63,6 +74,8 @@ export class SyncTask extends Task {
6374
*/
6475
class LazySyncProcessExecution extends ProcessExecution {
6576
private command?: Command;
77+
private killThis: Boolean = false;
78+
6679
constructor(
6780
private connection: ConnectionManager,
6881
private cli: CliWrapper,
@@ -117,6 +130,16 @@ class LazySyncProcessExecution extends ProcessExecution {
117130
}
118131

119132
getSyncCommand(): Command {
133+
if (
134+
this.connection.state !== "CONNECTED" &&
135+
(SyncTask.killAll() || this.killThis)
136+
) {
137+
this.killThis = true;
138+
return {
139+
args: [],
140+
command: "",
141+
};
142+
}
120143
if (this.command) {
121144
return this.command;
122145
}

0 commit comments

Comments
 (0)