Skip to content

[Bug]: TypeError when using .kill() on Alpine Linux in zx v8.8.4+ #1369

@examan

Description

@examan

What happened?

Calling .kill() on a ProcessPromise results in a TypeError on Alpine Linux in zx versions v8.8.4 and later. This worked correctly in v8.8.3.

The regression is likely caused by ps-tree failing to parse the output of BusyBox's ps command on Alpine.

How it should work?

.kill() should run without error and terminate the process.

How to reproduce the bug?

import { $ } from 'zx';

await $`sleep 10`.nothrow().kill();

Version

8.8.5

What's OS kind?

Linux

What JS runtime is used?

Node.js

Runtime Version

24.11.1

Error stack / relevant log output

/fx-src/node_modules/zx/build/vendor-core.cjs:825
var getBorders = (lines) => lines[0].spaces.reduce((m, i) => {
                                     ^

TypeError: Cannot read properties of undefined (reading 'spaces')
    at getBorders (/fx-src/node_modules/zx/build/vendor-core.cjs:825:38)
    at parseUnixGrid (/fx-src/node_modules/zx/build/vendor-core.cjs:834:19)
    at parse (/fx-src/node_modules/zx/build/vendor-core.cjs:945:10)
    at parse (/fx-src/node_modules/zx/build/vendor-core.cjs:1211:14)
    at Object.callback (/fx-src/node_modules/zx/build/vendor-core.cjs:1268:54)
    at ChildProcess.<anonymous> (/fx-src/node_modules/zx/build/vendor-core.cjs:1169:13)
    at Object.onceWrapper (node:events:623:26)
    at ChildProcess.emit (node:events:508:28)
    at maybeClose (node:internal/child_process:1101:16)
    at Socket.<anonymous> (node:internal/child_process:457:11)

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions