-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Labels
Description
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