Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Fixes erroneous non-null args.env check #872

Merged
merged 3 commits into from
Dec 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.

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

## [1.29.1]

- Fix for env configuration check that sometimes causes an error.

## [1.29.0]

- Xdebug Cloud support.
Expand Down
7 changes: 6 additions & 1 deletion src/phpDebug.ts
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,12 @@ class PhpDebugSession extends vscode.DebugSession {
})
try {
// Some checks
if (args.env !== undefined && args.program === undefined && args.runtimeArgs === undefined) {
if (
args.env &&
Object.keys(args.env).length !== 0 &&
args.program === undefined &&
args.runtimeArgs === undefined
) {
throw new Error(
`Cannot set env without running a program.\nPlease remove env from [${
args.name || 'unknown'
Expand Down
2 changes: 1 addition & 1 deletion src/test/adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ describe('PHP Debug Adapter', () => {
))

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

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