From 6cfe436c5b62569369e338f7a9e6035cea8cfdb8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=95=AA=E8=8C=84=E7=82=92=E8=9B=8B?= Date: Fri, 23 Dec 2022 13:38:35 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20nodejs=20v14=E5=8F=8A?= =?UTF-8?q?=E5=90=8E=E7=BB=AD=E7=89=88=E6=9C=AC=E6=89=A7=E8=A1=8C=20fis3?= =?UTF-8?q?=20release=20=E5=87=BA=E9=94=99=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fs.writeFileSync(path, data) 在 nodejs v14及后续版本中有相关的调整,(https://nodejs.org/docs/latest-v14.x/api/fs.html#fs_fs_writefilesync_file_data_options),这会导致fis3 release 在缓存 fis-conf.js 文件时、fis3 server start 在保存 pid 时出现错误,本次变更用于修复这些错误。 --- lib/util.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/util.js b/lib/util.js index ab3c8921d..51baf4802 100644 --- a/lib/util.js +++ b/lib/util.js @@ -724,6 +724,10 @@ _.write = function(path, data, charset, append) { if (!_exists(path)) { _.mkdir(_.pathinfo(path).dirname); } + // 兼容 nodejs v14 及后续版本 + if (data === undefined || data === null || typeof data === 'number') { + data += ''; + } if (charset) { data = getIconv().encode(data, charset); }