mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
Ensure cwd matches notebook path (#8137)
* Ensure cwd matches notebook path * add error checking * silent, don't store history
This commit is contained in:
@@ -333,6 +333,10 @@ export class JupyterSession implements nb.ISession {
|
|||||||
private async setEnvironmentVars(skip: boolean = false): Promise<void> {
|
private async setEnvironmentVars(skip: boolean = false): Promise<void> {
|
||||||
if (!skip && this.sessionImpl) {
|
if (!skip && this.sessionImpl) {
|
||||||
let allCode: string = '';
|
let allCode: string = '';
|
||||||
|
// Ensure cwd matches notebook path (this follows Jupyter behavior)
|
||||||
|
if (this.path && path.dirname(this.path)) {
|
||||||
|
allCode += `%cd ${path.dirname(this.path)}${EOL}`;
|
||||||
|
}
|
||||||
for (let i = 0; i < Object.keys(process.env).length; i++) {
|
for (let i = 0; i < Object.keys(process.env).length; i++) {
|
||||||
let key = Object.keys(process.env)[i];
|
let key = Object.keys(process.env)[i];
|
||||||
if (key.toLowerCase() === 'path' && this._pythonEnvVarPath) {
|
if (key.toLowerCase() === 'path' && this._pythonEnvVarPath) {
|
||||||
@@ -343,7 +347,9 @@ export class JupyterSession implements nb.ISession {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
let future = this.sessionImpl.kernel.requestExecute({
|
let future = this.sessionImpl.kernel.requestExecute({
|
||||||
code: allCode
|
code: allCode,
|
||||||
|
silent: true,
|
||||||
|
store_history: false
|
||||||
}, true);
|
}, true);
|
||||||
await future.done;
|
await future.done;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user