@netlify/build 27.9.0 → 27.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/log/logger.js +13 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@netlify/build",
3
- "version": "27.9.0",
3
+ "version": "27.9.1",
4
4
  "description": "Netlify build module",
5
5
  "type": "module",
6
6
  "exports": "./src/core/main.js",
package/src/log/logger.js CHANGED
@@ -125,13 +125,22 @@ const reduceLogLines = function (lines) {
125
125
  // Builds a function for logging data to the system logger (i.e. hidden from
126
126
  // the user-facing build logs)
127
127
  export const getSystemLogger = function (logs, debug, systemLogFile) {
128
- // If there's not a file descriptor (or it's set to 0, matching stdout), we
129
- // send debug lines to the normal logger. The same happens if the `debug`
130
- // flag is used, since that means we want to print logs to stdout.
131
- if (!systemLogFile || debug) {
128
+ // If the `debug` flag is used, we return a function that pipes system logs
129
+ // to the regular logger, as the intention is for them to end up in stdout.
130
+ if (debug) {
132
131
  return (...args) => log(logs, reduceLogLines(args))
133
132
  }
134
133
 
134
+ // If there's not a file descriptor configured for system logs and `debug`
135
+ // is not set, we return a no-op function that will swallow the errors.
136
+ if (!systemLogFile) {
137
+ return () => {
138
+ // no-op
139
+ }
140
+ }
141
+
142
+ // Return a function that writes to the file descriptor configured for system
143
+ // logs.
135
144
  const fileDescriptor = createWriteStream(null, { fd: systemLogFile })
136
145
 
137
146
  fileDescriptor.on('error', () => {