Re: [hackers] [dmenu][PATCH] Replace dmenu_run shell with executed application

From: Silvan Jegen <s.jegen_AT_gmail.com>
Date: Sun, 30 Dec 2018 14:45:49 +0100

Hi

[2018-12-30 13:41] Jan Bessai <jan.bessai_AT_tu-dortmund.de>
>
> Currently dmenu_run spawns a subshell and keeps running for each process
> it executes. Over time this litters up the process list with useless
> instances of dmenu_run, which do nothing but wait for their child to
> exit. The patch below replaces the dmenu_run process with its child,
> freeing up resources immediately. The difference is especially
> noticeable when dmenu is used in window managers.
>
> -- Jan
>
> ---
> dmenu_run | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/dmenu_run b/dmenu_run
> index 834ede5..5c9b4e8 100755
> --- a/dmenu_run
> +++ b/dmenu_run
> _AT_@ -1,2 +1,2 @@
> #!/bin/sh
> -dmenu_path | dmenu "$_AT_" | ${SHELL:-"/bin/sh"} &
> +exec `dmenu_path | dmenu "$_AT_"`

To keep this portable you should refrain from using backticks (`) and
use the POSIX-way:

exec $(dmenu_path | dmenu "$_AT_")


Cheers,

Silvan
Received on Sun Dec 30 2018 - 14:45:49 CET

This archive was generated by hypermail 2.3.0 : Sun Dec 30 2018 - 14:48:21 CET