Skip to content

Commit d405e4e

Browse files
authored
Merge #1148 'samCliLocalInvoke.ts: fix environment spec'
2 parents 1628575 + 96126ab commit d405e4e

File tree

4 files changed

+13
-3
lines changed

4 files changed

+13
-3
lines changed

package.nls.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@
316316
"AWS.samcli.error.notFound.brief": "Failed to get SAM CLI location",
317317
"AWS.samcli.error.invalid_schema_support_version": "Installed SAM executable does not support templates that require Event Schema selection. Required minimum version {0}, but found {1}",
318318
"AWS.samcli.local.invoke.ended": "Local invoke of SAM Application has ended.",
319-
"AWS.samcli.local.invoke.error": "Error encountered running local SAM Application",
319+
"AWS.samcli.local.invoke.error": "Error running local SAM Application: {0}",
320320
"AWS.samcli.local.invoke.port.not.open": "The debug port doesn't appear to be open. The debugger might not succeed when attaching to your SAM Application.",
321321
"AWS.samcli.local.invoke.runtime.unsupported": "Unsupported {0} runtime: {1}",
322322
"AWS.samcli.local.invoke.debugger.install": "Installing .NET Core Debugger to {0}...",

src/shared/sam/cli/samCliLocalInvoke.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ export class DefaultSamLocalInvokeCommand implements SamLocalInvokeCommand {
9696
onError: (error: Error): void => {
9797
this.channelLogger.error(
9898
'AWS.samcli.local.invoke.error',
99-
'Error encountered running local SAM Application',
99+
'Error running local SAM Application: {0}',
100100
error
101101
)
102102
debuggerPromiseClosed = true
@@ -217,7 +217,10 @@ export class SamCliLocalInvokeInvocation {
217217

218218
await this.args.invoker.invoke({
219219
options: {
220-
env: this.args.environmentVariables,
220+
env: {
221+
...process.env,
222+
...this.args.environmentVariables,
223+
},
221224
},
222225
command: 'sam',
223226
args: invokeArgs,

src/shared/sam/localLambdaRunner.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ export async function invokeLambdaFunction(
154154
if (!config.noDebug) {
155155
// Needed at least for dotnet case; harmless for others.
156156
samCliArgs.environmentVariables = {
157+
...samCliArgs.environmentVariables,
157158
SAM_BUILD_MODE: 'debug',
158159
}
159160
}

src/shared/utilities/childProcess.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,12 @@ export class ChildProcess {
7373
}
7474

7575
getLogger().info(`Running command: ${this.process} ${this.args.join(' ')}`)
76+
77+
// Async.
78+
// See also crossSpawn.spawnSync().
79+
// Arguments are forwarded[1] to node `child_process` module, see its documentation[2].
80+
// [1] https://github.com/moxystudio/node-cross-spawn/blob/master/index.js
81+
// [2] https://nodejs.org/api/child_process.html
7682
this.childProcess = crossSpawn(this.process, this.args, this.options)
7783

7884
this.childProcess.stdout?.on('data', (data: { toString(): string }) => {

0 commit comments

Comments
 (0)