Bug 38664: The tidy script - fix race condition

There was a race condition, edit_file trying to open it while it was not
fully written by prettier (?) This is a dirty fix but it seems to do the
trick.

The error was:
edit_file 'koha-tmpl/intranet-tmpl/prog/en/includes/cat-search.inc' - write_file: No such file or directory at misc/devel/tidy.pl line 149.

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
Jonathan Druart 2025-01-08 15:16:09 +01:00 committed by Katrin Fischer
parent 0cdaf9935f
commit 4a7a8fbef1
No known key found for this signature in database
GPG Key ID: 0EF6E2C03357A834
1 changed files with 2 additions and 0 deletions

View File

@ -138,6 +138,8 @@ sub tidy_tt {
run( command => sprintf q{yarn --silent run prettier --write %s}, $file );
if ($success) {
while ( !-f $file ) { sleep 1; }
# Revert the substitutions done by the prettier plugin
edit_file sub {
s#<!--</head>-->#</head>#g;