Skip to content

Commit 0a7a837

Browse files
keanuczzobo
andauthored
fix: Fixes erroneous non-null args.env check (#872)
* Fixes erroneous not-null check * Code format and updated test. * Changelog Co-authored-by: Damjan Cvetko <[email protected]>
1 parent f2546fd commit 0a7a837

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
44

55
The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/).
66

7+
## [1.29.1]
8+
9+
- Fix for env configuration check that sometimes causes an error.
10+
711
## [1.29.0]
812

913
- Xdebug Cloud support.

src/phpDebug.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,12 @@ class PhpDebugSession extends vscode.DebugSession {
414414
})
415415
try {
416416
// Some checks
417-
if (args.env !== undefined && args.program === undefined && args.runtimeArgs === undefined) {
417+
if (
418+
args.env &&
419+
Object.keys(args.env).length !== 0 &&
420+
args.program === undefined &&
421+
args.runtimeArgs === undefined
422+
) {
418423
throw new Error(
419424
`Cannot set env without running a program.\nPlease remove env from [${
420425
args.name || 'unknown'

src/test/adapter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ describe('PHP Debug Adapter', () => {
4141
))
4242

4343
it('should error on env without program', () =>
44-
assert.isRejected(Promise.all([client.launch({ env: {} }), client.configurationSequence()])))
44+
assert.isRejected(Promise.all([client.launch({ env: { some: 'key' } }), client.configurationSequence()])))
4545

4646
it('should run program to the end', () =>
4747
Promise.all([

0 commit comments

Comments
 (0)