Skip to content

Commit dd7f657

Browse files
committed
fix several issues with terminal in docker
1 parent a3823ae commit dd7f657

File tree

3 files changed

+15
-15
lines changed

3 files changed

+15
-15
lines changed

src/api/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ export class AtelierAPI {
215215
})
216216
.catch((error) => {
217217
if (error.error && error.error.code === "ECONNREFUSED") {
218-
setTimeout(checkConnection, 1000);
218+
setTimeout(checkConnection, 30000);
219219
}
220220
console.error(error);
221221
throw error;

src/extension.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -492,5 +492,7 @@ export async function activate(context: vscode.ExtensionContext): Promise<void>
492492
export function deactivate(): void {
493493
// This will ensure all pending events get flushed
494494
reporter.dispose();
495-
terminal.dispose();
495+
if (terminal) {
496+
terminal.dispose();
497+
}
496498
}

src/utils/index.ts

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -180,18 +180,16 @@ export async function terminalWithDocker(): Promise<vscode.Terminal> {
180180
const workspace = currentWorkspaceFolder();
181181

182182
const terminalName = `ObjectScript:${workspace}`;
183-
let terminal = vscode.window.terminals.find((el) => el.name === terminalName && el.exitStatus == undefined);
184-
if (!terminal) {
185-
terminal = vscode.window.createTerminal(terminalName, "docker-compose", [
186-
"-f",
187-
file,
188-
"exec",
189-
service,
190-
"/bin/bash",
191-
"-c",
192-
`command -v iris >/dev/null 2>&1 && iris session $ISC_PACKAGE_INSTANCENAME -U ${ns} || ccontrol session $ISC_PACKAGE_INSTANCENAME -U ${ns}`,
193-
]);
194-
}
195-
terminal.show();
183+
const terminal = vscode.window.createTerminal(terminalName, "docker-compose", [
184+
"-f",
185+
file,
186+
"exec",
187+
service,
188+
"/bin/bash",
189+
"-c",
190+
`[ -f /tmp/vscodesession.pid ] && kill $(cat /tmp/vscodesession.pid) >/dev/null 2>&1 ; echo $$ > /tmp/vscodesession.pid;
191+
$(command -v ccontrol || command -v iris) session $ISC_PACKAGE_INSTANCENAME -U ${ns}`,
192+
]);
193+
terminal.show(true);
196194
return terminal;
197195
}

0 commit comments

Comments
 (0)