Skip to content

Commit

Permalink
Linux: show newlines in commands as ? instead of space
Browse files Browse the repository at this point in the history
Since \n is used internally by htop to split command lines, replace \n
with \r in command lines to not display them as space.

Merging the command string will not work, but newlines in commands
should be rather the exception.
  • Loading branch information
cgzones committed May 11, 2024
1 parent 4b3dfa2 commit ef07d6e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions linux/LinuxProcessTable.c
Original file line number Diff line number Diff line change
Expand Up @@ -1172,6 +1172,12 @@ static bool LinuxProcessTable_readCmdlineFile(Process* process, openat_arg_t pro

/* newline used as delimiter - when forming the mergedCommand, newline is
* converted to space by Process_makeCommandStr */
if (argChar == '\n') {
/* Set to some other non-printable character */
command[i] = '\r';
continue;
}

if (argChar == '\0') {
command[i] = '\n';

Expand Down

0 comments on commit ef07d6e

Please sign in to comment.