Skip to content

fix: guard getBorders() against empty lines input#11

Open
Luc0-0 wants to merge 1 commit intowebpod:mainfrom
Luc0-0:fix/get-borders-empty-input
Open

fix: guard getBorders() against empty lines input#11
Luc0-0 wants to merge 1 commit intowebpod:mainfrom
Luc0-0:fix/get-borders-empty-input

Conversation

@Luc0-0
Copy link
Copy Markdown

@Luc0-0 Luc0-0 commented Mar 26, 2026

getBorders() crashes with TypeError: Cannot read properties of undefined (reading 'spaces') when called with an empty array.

This happens in practice when @webpod/ps runs ps -lx on BusyBox (Alpine Linux) — BusyBox doesn't support that flag, returns empty/malformed output, parseLines() produces [], and getBorders() blows up on lines[0].

Added an early return for empty input and a test covering it.

Related: google/zx#1369

When ps output is empty or malformed (e.g. BusyBox on Alpine),
parseLines() returns an empty array and getBorders() crashes
trying to access lines[0].spaces on undefined.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant