Skip to content

w: Fix formatting of command line value#666

Open
alxndrv wants to merge 1 commit intouutils:mainfrom
alxndrv:w-fix-cmdline-formatting
Open

w: Fix formatting of command line value#666
alxndrv wants to merge 1 commit intouutils:mainfrom
alxndrv:w-fix-cmdline-formatting

Conversation

@alxndrv
Copy link
Copy Markdown

@alxndrv alxndrv commented Apr 8, 2026

The command line value exposed by the kernel in /proc/<pid>/cmdline represents whitespace as NULL bytes.
Using read_to_string() on this directly will cause the output to join all parts of the original command into one long string.
This PR adds a very simple fix to avoid this.

Before:

$ cargo run -q w
 22:16:22 up  2:00,  1 user,  load average: 0.32, 0.37, 0.38
USER     TTY       LOGIN@   IDLE   JCPU   PCPU  WHAT
alx      tty1      20:16    1:59m  0.00   0     /bin/sh/usr/bin/niri-session-l

After:

$ cargo run -q w
 22:17:02 up  2:00,  1 user,  load average: 0.67, 0.46, 0.41
USER     TTY       LOGIN@   IDLE   JCPU   PCPU  WHAT
alx      tty1      20:16    2:00m  0.00   0     /bin/sh /usr/bin/niri-session -l 

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 9, 2026

Codecov Report

❌ Patch coverage is 0% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 19.18%. Comparing base (ee98c0a) to head (5aaa4cd).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
src/uu/w/src/w.rs 0.00% 6 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #666      +/-   ##
==========================================
- Coverage   19.19%   19.18%   -0.01%     
==========================================
  Files          68       68              
  Lines       10135    10139       +4     
  Branches      545      545              
==========================================
  Hits         1945     1945              
- Misses       8190     8194       +4     
Flag Coverage Δ
macos_latest 6.74% <ø> (ø)
ubuntu_latest 19.54% <0.00%> (-0.01%) ⬇️
windows_latest 0.02% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Bluemangoo
Copy link
Copy Markdown
Collaborator

Can you fix the tests?

@alxndrv alxndrv force-pushed the w-fix-cmdline-formatting branch from e28cc66 to 5aaa4cd Compare April 9, 2026 14:12
@alxndrv
Copy link
Copy Markdown
Author

alxndrv commented Apr 9, 2026

Tests are fixed now, but I'm a bit confused by the coverage check. Is there anything I can do to make it come up as successful?

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.

2 participants