Skip to content

fix several issues with terminal in docker #158

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 25, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ on:
- created
jobs:
build:
timeout-minutes: 10
runs-on: ${{ matrix.os }}
strategy:
matrix:
Expand Down
2 changes: 1 addition & 1 deletion src/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ export class AtelierAPI {
})
.catch((error) => {
if (error.error && error.error.code === "ECONNREFUSED") {
setTimeout(checkConnection, 1000);
setTimeout(checkConnection, 30000);
}
console.error(error);
throw error;
Expand Down
4 changes: 3 additions & 1 deletion src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -492,5 +492,7 @@ export async function activate(context: vscode.ExtensionContext): Promise<void>
export function deactivate(): void {
// This will ensure all pending events get flushed
reporter.dispose();
terminal.dispose();
if (terminal) {
terminal.dispose();
}
}
24 changes: 11 additions & 13 deletions src/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,18 +180,16 @@ export async function terminalWithDocker(): Promise<vscode.Terminal> {
const workspace = currentWorkspaceFolder();

const terminalName = `ObjectScript:${workspace}`;
let terminal = vscode.window.terminals.find((el) => el.name === terminalName && el.exitStatus == undefined);
if (!terminal) {
terminal = vscode.window.createTerminal(terminalName, "docker-compose", [
"-f",
file,
"exec",
service,
"/bin/bash",
"-c",
`command -v iris >/dev/null 2>&1 && iris session $ISC_PACKAGE_INSTANCENAME -U ${ns} || ccontrol session $ISC_PACKAGE_INSTANCENAME -U ${ns}`,
]);
}
terminal.show();
const terminal = vscode.window.createTerminal(terminalName, "docker-compose", [
"-f",
file,
"exec",
service,
"/bin/bash",
"-c",
`[ -f /tmp/vscodesession.pid ] && kill $(cat /tmp/vscodesession.pid) >/dev/null 2>&1 ; echo $$ > /tmp/vscodesession.pid;
$(command -v ccontrol || command -v iris) session $ISC_PACKAGE_INSTANCENAME -U ${ns}`,
]);
terminal.show(true);
return terminal;
}