diff --git a/lib/pip.js b/lib/pip.js index ccb809c3..149c0285 100644 --- a/lib/pip.js +++ b/lib/pip.js @@ -412,6 +412,16 @@ async function installRequirements(targetFolder, pluginInstance) { 'PYTHON_REQUIREMENTS_COMMAND_NOT_FOUND' ); } + + if (cmd === 'docker' && e.stderrBuffer) { + throw new pluginInstance.serverless.classes.Error( + `Running "${cmd} ${args.join(' ')}" failed with: "${e.stderrBuffer + .toString() + .trim()}"`, + 'PYTHON_REQUIREMENTS_DOCKER_COMMAND_FAILED' + ); + } + if (log) { log.info(`Stdout: ${e.stdoutBuffer}`); log.info(`Stderr: ${e.stderrBuffer}`); diff --git a/test.js b/test.js index 0ecd361d..26b4b477 100644 --- a/test.js +++ b/test.js @@ -216,6 +216,7 @@ test( dockerImage: 'break the build to log the command', }, }); + console.log('STDOUT', stdout); t.true( stdout.includes( `-v ${__dirname}${sep}tests${sep}base${sep}custom_ssh:/root/.ssh/custom_ssh:z`