Skip to content

Commit 411ccb3

Browse files
committed
fix several issues with terminal in docker
1 parent 7cf800a commit 411ccb3

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
@@ -203,7 +203,7 @@ export class AtelierAPI {
203203
})
204204
.catch(error => {
205205
if (error.error && error.error.code === "ECONNREFUSED") {
206-
setTimeout(checkConnection, 1000);
206+
setTimeout(checkConnection, 30000);
207207
}
208208
console.error(error);
209209
throw error;

src/extension.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -474,5 +474,7 @@ export async function activate(context: vscode.ExtensionContext): Promise<void>
474474
export function deactivate() {
475475
// This will ensure all pending events get flushed
476476
reporter.dispose();
477-
terminal.dispose();
477+
if (terminal) {
478+
terminal.dispose();
479+
}
478480
}

src/utils/index.ts

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

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

0 commit comments

Comments
 (0)