Today at 12:25am, Jeremy C. Reed said:

> On Wed, 23 May 2001, Scott Micciche wrote:
>
> > I have a question surrounding blackbox's "sh -c" processes when
> > launching from the menu.  I'm not familiar with writing window managers
> > and was wondering why these processes were necessary.  I notice other
> > window managers do not use them (fvwm, icewm, windowmaker, etc).  Is
> > there some way to eliminate these processes from occurring?  Thanks in
> > advance.
>
> I have also wondered about it. One benefit of using "sh -c" is so you can
> have multiple commands with arguments, pipes, output redirection all as
> part of a blackbox menu [exec] entry.
>
> >From looking at twm source, it appears to do the same thing.
>
> As a workaround, I just added "exec " before the command I want to
> start. (I am sure /bin/sh ran, but then the sh process is replaced with
> the specified command.)
>
> I guess it would be good to offer it without /bin/sh also, by simply
> execing the command with its aruments (but no shell functionality
> included).

I may have been the cause for this: I wanted to be able to run commands,
redirections and pipelines from the menu (like bbkeys does it).

However, when running a command through sh -c, the shell will determine if
there is a compound command (pipeline or redir.) or not.

If not, sh -c will not spawn a new process for the command, but instead
replace itself. So:

    sh -c 'exec netscape'

yields exactly the same result as:

    sh -c 'netscape'

So the shell will not spoil a process if it's not necessary.

It might be an idea to let blackbox decide if a command is compound or
not. That way sh doesn't have to be started with simple commands.

Regards,
Wilbert


-- 
 /"\  . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  /"\
 \ /   ASCII Ribbon Campaign       Wilbert Berendsen             \ /
  X   - NO HTML/RTF in e-mail      http://www.xs4all.nl/~wbsoft   X
 / \  - NO MSWord docs in e-mail   http://linuxathome.nl         / \

Reply via email to