Skip to content

Conversation

@stokito
Copy link

@stokito stokito commented Jan 11, 2026

This is partial fix to #4
The ps returns a command trimmed to 18 chars and some processes may have spaces in their title. Then we parsing by splitting by a space. So there is two problems: unquoted title and its stripping.
From the man ps:

comm COMMAND command name (only the executable name). The output in this column may contain spaces. (alias ucmd, ucomm). See also the args format keyword, the -f
option, and the c option.
When specified last, this column will extend to the edge of the display. If ps can not determine display width, as when output is redirected (piped) into a
file or another command, the output width is undefined (it may be 80, unlimited, determined by the TERM variable, and so on). The COLUMNS environment
variable or --cols option may be used to exactly determine the width in this case. The w or -w option may be also be used to adjust width.

In fact, the ps only shows contents of the /proc/ directory. You may run it with strace ps to see what it does. So the app should just do the same itself without relaying on the ps. Maybe there are some libraries or existing projects who does this. The IntelliJ Idea and Android Studio do have such process explorers

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