diff --git a/packages/editor/src/editor.ts b/packages/editor/src/editor.ts index 5aa4c0b78f..dcf9449f2f 100644 --- a/packages/editor/src/editor.ts +++ b/packages/editor/src/editor.ts @@ -66,7 +66,7 @@ export class Editor { // In case of using VSCode as an external editor, // detect whether the MongoDB extension is installed and open a .mongodb file. - // If not open a .js file instead. + // If not open a .js file. async _getExtension(cmd: string): Promise { if (!this._isVscodeApp(cmd)) { return 'js'; @@ -170,7 +170,11 @@ export class Editor { code }); - const proc = spawn(editor, [tmpDoc], { stdio: 'inherit' }); + const proc = spawn(editor, [path.basename(tmpDoc)], { + stdio: 'inherit', + cwd: path.dirname(tmpDoc), + shell: true + }); // Pause the parent readable stream to stop emitting data events // and get a child the total control over the input. this._input.pause();