Skip to content

Commit

Permalink
fix: merge environment variables for #705 (#706)
Browse files Browse the repository at this point in the history
* fix: Merge environment variables for #705
  • Loading branch information
kaysonwu authored and zobo committed Jan 22, 2022
1 parent 7c8529a commit 30b3dc7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
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.23.0]

- When `env` is specified in launch configuration it will be merged the process environment.

## [1.22.0]

### Added
Expand Down
5 changes: 4 additions & 1 deletion src/phpDebug.ts
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,10 @@ class PhpDebugSession extends vscode.DebugSession {
const program = args.program ? [args.program] : []
const cwd = args.cwd || process.cwd()
const env = Object.fromEntries(
Object.entries(args.env || process.env).map(v => [v[0], v[1]?.replace('${port}', port.toString())])
Object.entries({ ...process.env, ...args.env }).map(v => [
v[0],
v[1]?.replace('${port}', port.toString()),
])
)
// launch in CLI mode
if (args.externalConsole) {
Expand Down

0 comments on commit 30b3dc7

Please sign in to comment.