From 19d857499671c20035712461a4fce4696e7a9585 Mon Sep 17 00:00:00 2001 From: Darshan Sen Date: Mon, 3 Oct 2022 10:46:48 +0530 Subject: [PATCH] tools: fix timezone update tool The spawnSync call was previously silently failing with this error: ```sh icupkg: unable to open input file "icudt*.dat" ``` because spawnSync doesn't support globbing. This change replaces the spawnSync call with execSync because that supports globbing. I have tested this workflow with some minor modifications in my fork and I can confirm that it works as expected now. The bot opened this PR - https://github.com/RaisinTen/node/pull/2 which updates deps/icu-small/source/data/in/icudt71l.dat.bz2. Fixes: https://github.com/nodejs/node/issues/44865 Signed-off-by: Darshan Sen PR-URL: https://github.com/nodejs/node/pull/44870 Reviewed-By: Richard Lau Reviewed-By: Antoine du Hamel --- tools/update-timezone.mjs | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/tools/update-timezone.mjs b/tools/update-timezone.mjs index 33da42f4e983fa..bf3498b8abf230 100755 --- a/tools/update-timezone.mjs +++ b/tools/update-timezone.mjs @@ -1,6 +1,6 @@ #!/usr/bin/env node // Usage: tools/update-timezone.mjs -import { execSync, spawnSync } from 'node:child_process'; +import { execSync } from 'node:child_process'; import { renameSync, readdirSync, rmSync } from 'node:fs'; import { exit } from 'node:process'; @@ -26,13 +26,7 @@ if (latestVersion === currentVersion) { execSync('bzip2 -d deps/icu-small/source/data/in/icudt*.dat.bz2'); fileNames.forEach((file) => { renameSync(`icu-data/tzdata/icunew/${latestVersion}/44/le/${file}`, `deps/icu-small/source/data/in/${file}`); - spawnSync( - 'icupkg', [ - '-a', - file, - 'icudt*.dat', - ], { cwd: 'deps/icu-small/source/data/in/' } - ); + execSync(`icupkg -a ${file} icudt*.dat`, { cwd: 'deps/icu-small/source/data/in/' }); rmSync(`deps/icu-small/source/data/in/${file}`); }); execSync('bzip2 -z deps/icu-small/source/data/in/icudt*.dat');