mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-30 12:11:56 +00:00
fix: rsync progress regex never matched, spamming logs during backup
The regex used `$` (end-of-string anchor) instead of no anchor, so it never matched the percentage in rsync output. Every line, including empty ones, was logged instead of parsed.
This commit is contained in:
@@ -280,9 +280,9 @@ async function runRsync(rsyncOptions: {
|
||||
spawned.stdout.on('data', (data: unknown) => {
|
||||
const lines = String(data).replace(/\r/g, '\n').split('\n')
|
||||
for (const line of lines) {
|
||||
const parsed = /$([0-9.]+)%/.exec(line)?.[1]
|
||||
const parsed = /([0-9.]+)%/.exec(line)?.[1]
|
||||
if (!parsed) {
|
||||
console.log(line)
|
||||
if (line) console.log(line)
|
||||
continue
|
||||
}
|
||||
percentage = Number.parseFloat(parsed)
|
||||
|
||||
Reference in New Issue
Block a user