Skip to content

Commit ef07d6e

Browse files
committed
Linux: show newlines in commands as ? instead of space
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.
1 parent 4b3dfa2 commit ef07d6e

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

linux/LinuxProcessTable.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1172,6 +1172,12 @@ static bool LinuxProcessTable_readCmdlineFile(Process* process, openat_arg_t pro
11721172

11731173
/* newline used as delimiter - when forming the mergedCommand, newline is
11741174
* converted to space by Process_makeCommandStr */
1175+
if (argChar == '\n') {
1176+
/* Set to some other non-printable character */
1177+
command[i] = '\r';
1178+
continue;
1179+
}
1180+
11751181
if (argChar == '\0') {
11761182
command[i] = '\n';
11771183

0 commit comments

Comments
 (0)