Skip to content

cli: handle SIGPIPE to prevent broken pipe panic#3395

Merged
martinsander00 merged 1 commit intomainfrom
ms/3387-monorepo
Mar 27, 2026
Merged

cli: handle SIGPIPE to prevent broken pipe panic#3395
martinsander00 merged 1 commit intomainfrom
ms/3387-monorepo

Conversation

@martinsander00
Copy link
Copy Markdown
Contributor

@martinsander00 martinsander00 commented Mar 27, 2026

Resolves: #3387

Summary

  • Rust ignores SIGPIPE at startup, causing println! to panic with "Broken pipe" when piping CLI output to head, grep, etc.
  • Reset SIGPIPE to SIG_DFL at the start of main() in all 3 CLI binaries (doublezero, doublezero-geolocation, doublezero-admin) so the process exits silently like standard CLI tools

Lines of Code

Section Added Removed
client/doublezero +5 -0
client/doublezero-geolocation-cli +5 -0
controlplane/doublezero-admin +5 -0
Cargo.lock +3 -0

Testing Verification

ubuntu@chi-dn-bm2:~$ doublezero device list | head -n 5
 account                                      | code                  | contributor | location | exchange | device_type | public_ip  | dz_prefixes    | users | max_users | status              | health          | mgmt_vrf   | owner                                        
 8PQkip3CxWhQTdP7doCyhT2kwjSL2csRTdnRg2zbDPs1 | chi-dn-dzd1           | co01        | chi      | xchi     | hybrid      | 100.0.0.1  | 198.18.0.0/24  | 0     | 128       | activated           | ready-for-users | management | DZfHfcCXTLwgZeCRKQ1FL1UuwAwFAZM93g86NMYpfYan 
 4CkvmyquGN4qtXLNj3hpJcqYbb7PCanLbU1rQHHdp6xp | chi-dn-dzd3-delete-me | co01        | chi      | xchi     | hybrid      | 0.1.2.3    | 198.18.4.0/24  | 0     | 0         | activated           | ready-for-users |            | DZfHfcCXTLwgZeCRKQ1FL1UuwAwFAZM93g86NMYpfYan 
 HzndSULmxcc95Zj8c3u3dKKt6YQN7fc1XW92cZvwyxC5 | greg-test-dev         | co01        | chi      | xchi     | hybrid      | 1.2.3.4    | 198.18.42.0/24 | 0     | 0         | activated           | ready-for-users | default    | DZfHfcCXTLwgZeCRKQ1FL1UuwAwFAZM93g86NMYpfYan 
 GV98Pn3xZR3dyMsbD7VMRSrpoN3qj3ch9f69mmW6LHj3 | nikw-test             | co01        | chi      | xchi     | hybrid      | 1.2.3.8    | 198.18.9.0/24  | 0     | 0         | device-provisioning | ready-for-users | default    | DZfHfcCXTLwgZeCRKQ1FL1UuwAwFAZM93g86NMYpfYan 
ubuntu@chi-dn-bm2:~$ 

@martinsander00 martinsander00 merged commit b80ca03 into main Mar 27, 2026
44 of 46 checks passed
@martinsander00 martinsander00 deleted the ms/3387-monorepo branch March 27, 2026 18:24
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.

Broken pipe when using head in various dz commands

2 participants