Skip to content

"Call open in new window" only when the terminal process ends. #3

@iamAbhishekkumar

Description

@iamAbhishekkumar

I haven't found any way to check when my terminal process ends. So, i hard coded a delay of 4 s after my terminal process starts.

function genEnvironment(folderPath, additionalCommand = "") {
    const originalFolderPath = folderPath;
    folderPath = `'${folderPath}'`;  // to fix that if their is space in between the path.
    const terminal = vscode.window.createTerminal(`bash`);
    terminal.show(true);
    terminal.sendText(`cd ${folderPath}`);
    terminal.sendText(`python3 -m venv env || python -m venv env`);
    terminal.sendText(`source ${folderPath}/env/bin/activate`);
    if (additionalCommand != "")
        terminal.sendText(additionalCommand); // can be used for pip install flask
    terminal.sendText(`pip freeze > ${folderPath}/requirements.txt`);
    terminal.sendText(`deactivate`);
    terminal.sendText(`exit`);
    sleep(4000).then(() => commands.openInNewWindow(originalFolderPath));
}

PATH TO THIS FUNCTION = scripts/generate.js

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions