Fix release cookie on Windows (#2012)

This commit is contained in:
Wojtek Mach 2023-06-27 13:33:18 +02:00 committed by GitHub
parent a73cea19cc
commit 4899767673
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View file

@ -13,7 +13,8 @@ set PATH=!RELEASE_ROOT!\vendor\otp\erts-<%= @release.erts_version%>\bin;!RELEASE
set cookie_path=!RELEASE_ROOT!\releases\COOKIE
if not exist %cookie_path% (
for /f "skip=1" %%X in ('wmic os get localdatetime') do if not defined TIMESTAMP set TIMESTAMP=%%X
echo cookie-!TIMESTAMP:~0,11!-!RANDOM! > %cookie_path%
:: '| set /p=""' is so that we don't add ' \r\n' to the cookie
echo | set /p="cookie-!TIMESTAMP:~0,11!-!RANDOM!" > %cookie_path%
)
cd !HOMEDRIVE!!HOMEPATH!

View file

@ -7,6 +7,7 @@ set cookie_path="!RELEASE_ROOT!\releases\COOKIE"
if not exist %cookie_path% (
if not defined RELEASE_COOKIE (
for /f "skip=1" %%X in ('wmic os get localdatetime') do if not defined TIMESTAMP set TIMESTAMP=%%X
echo cookie-!TIMESTAMP:~0,11!-!RANDOM! > %cookie_path%
:: '| set /p=""' is so that we don't add ' \r\n' to the cookie
echo | set /p="cookie-!TIMESTAMP:~0,11!-!RANDOM!" > %cookie_path%
)
)