Skip to content

Commit 78da3e0

Browse files
committed
fix #823
1 parent 54e86b1 commit 78da3e0

5 files changed

Lines changed: 41 additions & 41 deletions

File tree

package.json

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"engines": {
2626
"vscode": "^1.9.0"
2727
},
28-
"recommendations":[
28+
"recommendations": [
2929
"donjayamanne.jupyter"
3030
],
3131
"keywords": [
@@ -286,7 +286,7 @@
286286
"pythonPath": "$${{config:python.pythonPath}}",
287287
"program": "$${{file}}",
288288
"cwd": "$${{workspaceRoot}}",
289-
"env": null,
289+
"env": {},
290290
"envFile": "$${{workspaceRoot}}/.env",
291291
"debugOptions": [
292292
"WaitOnAbnormalExit",
@@ -314,7 +314,7 @@
314314
},
315315
"program": "$${{file}}",
316316
"cwd": "$${{workspaceRoot}}",
317-
"env": null,
317+
"env": {},
318318
"envFile": "$${{workspaceRoot}}/.env",
319319
"debugOptions": [
320320
"WaitOnAbnormalExit",
@@ -334,7 +334,7 @@
334334
"pythonPath": "$${{config:python.pythonPath}}",
335335
"module": "module.name",
336336
"cwd": "$${{workspaceRoot}}",
337-
"env": null,
337+
"env": {},
338338
"envFile": "$${{workspaceRoot}}/.env",
339339
"debugOptions": [
340340
"WaitOnAbnormalExit",
@@ -353,9 +353,9 @@
353353
"stopOnEntry": true,
354354
"pythonPath": "$${{config:python.pythonPath}}",
355355
"program": "$${{file}}",
356-
"cwd": null,
356+
"cwd": "",
357357
"console": "integratedTerminal",
358-
"env": null,
358+
"env": {},
359359
"envFile": "$${{workspaceRoot}}/.env",
360360
"debugOptions": [
361361
"WaitOnAbnormalExit",
@@ -373,9 +373,9 @@
373373
"stopOnEntry": true,
374374
"pythonPath": "$${{config:python.pythonPath}}",
375375
"program": "${{file}}",
376-
"cwd": null,
376+
"cwd": "",
377377
"console": "externalTerminal",
378-
"env": null,
378+
"env": {},
379379
"envFile": "$${{workspaceRoot}}/.env",
380380
"debugOptions": [
381381
"WaitOnAbnormalExit",
@@ -398,7 +398,7 @@
398398
"runserver",
399399
"--noreload"
400400
],
401-
"env": null,
401+
"env": {},
402402
"envFile": "$${{workspaceRoot}}/.env",
403403
"debugOptions": [
404404
"WaitOnAbnormalExit",
@@ -447,7 +447,7 @@
447447
"program": "$${{workspaceRoot}}/run.py",
448448
"cwd": "$${{workspaceRoot}}",
449449
"args": [],
450-
"env": null,
450+
"env": {},
451451
"envFile": "$${{workspaceRoot}}/.env",
452452
"debugOptions": [
453453
"WaitOnAbnormalExit",
@@ -472,7 +472,7 @@
472472
"runserver",
473473
"--noreload=True"
474474
],
475-
"env": null,
475+
"env": {},
476476
"envFile": "$${{workspaceRoot}}/.env",
477477
"debugOptions": [
478478
"WaitOnAbnormalExit",
@@ -546,8 +546,8 @@
546546
},
547547
"cwd": {
548548
"type": "string",
549-
"description": "Absolute path to the working directory of the program being debugged. Default is the root directory of the file (leave null).",
550-
"default": null
549+
"description": "Absolute path to the working directory of the program being debugged. Default is the root directory of the file (leave empty).",
550+
"default": ""
551551
},
552552
"debugOptions": {
553553
"type": "array",
@@ -604,12 +604,12 @@
604604
"env": {
605605
"type": "object",
606606
"description": "Environment variables defined as a key value pair. Property ends up being the Environment Variable and the value of the property ends up being the value of the Env Variable.",
607-
"default": null
607+
"default": {}
608608
},
609609
"envFile": {
610610
"type": "string",
611611
"description": "Absolute path to a file containing environment variable definitions.",
612-
"default": null
612+
"default": ""
613613
}
614614
}
615615
},
@@ -627,12 +627,12 @@
627627
"remoteRoot": {
628628
"type": "string",
629629
"description": "The source root of the remote host.",
630-
"default": null
630+
"default": ""
631631
},
632632
"port": {
633633
"type": "number",
634634
"description": "Debug port to attach",
635-
"default": null
635+
"default": 0
636636
},
637637
"host": {
638638
"type": "string",
@@ -655,7 +655,7 @@
655655
"pythonPath": "${config:python.pythonPath}",
656656
"program": "${file}",
657657
"cwd": "${workspaceRoot}",
658-
"env": null,
658+
"env": {},
659659
"envFile": "${workspaceRoot}/.env",
660660
"debugOptions": [
661661
"WaitOnAbnormalExit",
@@ -679,7 +679,7 @@
679679
},
680680
"program": "${file}",
681681
"cwd": "${workspaceRoot}",
682-
"env": null,
682+
"env": {},
683683
"envFile": "${workspaceRoot}/.env",
684684
"debugOptions": [
685685
"WaitOnAbnormalExit",
@@ -695,7 +695,7 @@
695695
"pythonPath": "${config:python.pythonPath}",
696696
"module": "module.name",
697697
"cwd": "${workspaceRoot}",
698-
"env": null,
698+
"env": {},
699699
"envFile": "${workspaceRoot}/.env",
700700
"debugOptions": [
701701
"WaitOnAbnormalExit",
@@ -710,9 +710,9 @@
710710
"stopOnEntry": true,
711711
"pythonPath": "${config:python.pythonPath}",
712712
"program": "${file}",
713-
"cwd": null,
713+
"cwd": "",
714714
"console": "integratedTerminal",
715-
"env": null,
715+
"env": {},
716716
"envFile": "${workspaceRoot}/.env",
717717
"debugOptions": [
718718
"WaitOnAbnormalExit",
@@ -726,9 +726,9 @@
726726
"stopOnEntry": true,
727727
"pythonPath": "${config:python.pythonPath}",
728728
"program": "${file}",
729-
"cwd": null,
729+
"cwd": "",
730730
"console": "externalTerminal",
731-
"env": null,
731+
"env": {},
732732
"envFile": "${workspaceRoot}/.env",
733733
"debugOptions": [
734734
"WaitOnAbnormalExit",
@@ -747,7 +747,7 @@
747747
"runserver",
748748
"--noreload"
749749
],
750-
"env": null,
750+
"env": {},
751751
"envFile": "${workspaceRoot}/.env",
752752
"debugOptions": [
753753
"WaitOnAbnormalExit",
@@ -788,7 +788,7 @@
788788
"program": "${workspaceRoot}/run.py",
789789
"cwd": "${workspaceRoot}",
790790
"args": [],
791-
"env": null,
791+
"env": {},
792792
"envFile": "${workspaceRoot}/.env",
793793
"debugOptions": [
794794
"WaitOnAbnormalExit",
@@ -803,7 +803,7 @@
803803
"stopOnEntry": true,
804804
"pythonPath": "${config:python.pythonPath}",
805805
"cwd": "${workspaceRoot}",
806-
"env": null,
806+
"env": {},
807807
"envFile": "${workspaceRoot}/.env",
808808
"args": [
809809
"${workspaceRoot}/development.ini"
@@ -828,7 +828,7 @@
828828
"runserver",
829829
"--noreload=True"
830830
],
831-
"env": null,
831+
"env": {},
832832
"envFile": "${workspaceRoot}/.env",
833833
"debugOptions": [
834834
"WaitOnAbnormalExit",

src/client/common/open.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ export function open(opts: any): Promise<childProcess.ChildProcess> {
1616
var appArgs = [];
1717
var args = [];
1818
var cpOpts: any = {};
19-
if (opts.cwd) {
19+
if (opts.cwd && typeof opts.cwd === 'string' && opts.cwd.length > 0) {
2020
cpOpts.cwd = opts.cwd;
2121
}
22-
if (opts.env) {
22+
if (opts.env && Object.keys(opts.env).length > 0) {
2323
cpOpts.env = opts.env;
2424
}
2525

@@ -30,11 +30,11 @@ export function open(opts: any): Promise<childProcess.ChildProcess> {
3030

3131
if (process.platform === 'darwin') {
3232
const sudoPrefix = opts.sudo === true ? 'sudo ' : '';
33-
cmd = 'osascript';
34-
args = [ '-e', 'tell application "terminal"',
35-
'-e', 'activate',
36-
'-e', 'do script "' + sudoPrefix + [opts.app].concat(appArgs).join(" ") + '"',
37-
'-e', 'end tell' ];
33+
cmd = 'osascript';
34+
args = ['-e', 'tell application "terminal"',
35+
'-e', 'activate',
36+
'-e', 'do script "' + sudoPrefix + [opts.app].concat(appArgs).join(" ") + '"',
37+
'-e', 'end tell'];
3838
} else if (process.platform === 'win32') {
3939
cmd = 'cmd';
4040
args.push('/c', 'start');
@@ -59,10 +59,10 @@ export function open(opts: any): Promise<childProcess.ChildProcess> {
5959
var cp = childProcess.spawn(cmd, args, cpOpts);
6060

6161
if (opts.wait) {
62-
return new Promise(function(resolve, reject) {
62+
return new Promise(function (resolve, reject) {
6363
cp.once('error', reject);
6464

65-
cp.once('close', function(code) {
65+
cp.once('close', function (code) {
6666
if (code > 0) {
6767
reject(new Error('Exited with code ' + code));
6868
return;

src/client/debugger/Common/Utils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,10 +132,10 @@ export function getCustomEnvVars(envVars: any, envFile: string): any {
132132
}
133133
}
134134
let configVars = null;
135-
if (envVars && envFileVars) {
135+
if (envVars && Object.keys(envVars).length > 0 && envFileVars) {
136136
configVars = mergeEnvVariables(envVars, envFileVars);
137137
}
138-
if (envVars) {
138+
if (envVars && Object.keys(envVars).length > 0) {
139139
configVars = envVars;
140140
}
141141
if (envFileVars) {

src/client/debugger/Main.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ export class PythonDebugger extends DebugSession {
215215
Debug_DebugOptions: args.debugOptions.join(","),
216216
Debug_DJango: args.debugOptions.indexOf("DjangoDebugging") >= 0 ? "true" : "false",
217217
Debug_PySpark: typeof args.pythonPath === 'string' && args.pythonPath.indexOf('spark-submit') > 0 ? 'true' : 'false',
218-
Debug_HasEnvVaraibles: args.env && typeof args.env === "object" ? "true" : "false"
218+
Debug_HasEnvVaraibles: args.env && typeof args.env === "object" && Object.keys(args.env).length > 0 ? "true" : "false"
219219
}));
220220

221221
this.launchArgs = args;

src/client/singleFileDebug.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export function activateSingleFileDebug() {
2020
config.args = [];
2121
config.console = "none";
2222
config.exceptionHandling = [];
23-
config.env = null;
23+
config.env = {};
2424

2525
if (vscode.workspace.rootPath) {
2626
config.cwd = vscode.workspace.rootPath;

0 commit comments

Comments
 (0)