zsh-users
 help / color / mirror / code / Atom feed
* Re: exec problem
@ 2002-11-26 17:41 x x
  2002-11-26 18:38 ` John Buttery
  0 siblings, 1 reply; 5+ messages in thread
From: x x @ 2002-11-26 17:41 UTC (permalink / raw)
  To: zsh-users

[-- Attachment #1: Type: text/plain, Size: 1429 bytes --]

John Buttery wrote:

>* x x <pbyrne76@hotmail.com> [2002-11-26 13:31:25 +0000]:
>
>>In 4.0.4 when I issue an 'exec' and zsh can't find
>>the executable it simply terminates without warning.
>>This is surly not desirable behaviour.
>>
>>[snip function to create a "safe" exec]
>>
>>Shouldn't this be builtin?
>
>
>  My gut feeling is that zsh's behaviour in this regard is correct,
>since I always thought there was a core belief (among UNIX software in
>general, not just zsh) that the software should "do what I say, exactly
>as I say, and not second-guess me".
>  However, having said that, I think your function is quite useful
>and that a lot of people will like/use it (possibly myself included).
>Thanks for taking the time to write it. :)
>

But zsh doesn't do what the user says and certainly
isn't doing what he wants. From a users perspective
an exec has two parts:
1. run a new command without forking
2. terminate the shell

Since zsh cannot complete the first part it should not try to
do the second. More generally if a composite action is composed
of several steps, each of which must be completed in order
for the composite to be completed, then an exception should
be generated if any step fails causing the complete action
to fail gracefully.


_________________________________________________________________
MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*. 
http://join.msn.com/?page=features/virus

[-- Attachment #2: Type: text/html, Size: 133 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread
* exec problem
@ 2002-11-26 13:31 x x
  2002-11-26 16:55 ` John Buttery
  2002-11-26 17:51 ` Dan Nelson
  0 siblings, 2 replies; 5+ messages in thread
From: x x @ 2002-11-26 13:31 UTC (permalink / raw)
  To: zsh-users

In 4.0.4 when I issue an 'exec' and zsh can't find
the executable it simply terminates without warning.
This is surly not desirable behaviour.

In bash the shell first checks to see if the command
is available and executable and if not it issues an
appropriate error message. The following function approximates
the bash bahaviour.

function exec {
  if [[ $# = 0 ]]; then
    builtin exec
  elif [[ -f $1 ]]; then
    if [[ -x $1 ]]; then
      builtin exec $*
    else
      echo "zsh: exec: $1: cannot execute: Permission denied"
    fi
  else
    echo "zsh: exec: $1: cannot execute: No such file or directory"
  fi
}

Shouldn't this be builtin?


Thanks,
Pascal


_________________________________________________________________
STOP MORE SPAM with the new MSN 8 and get 2 months FREE* 
http://join.msn.com/?page=features/junkmail




^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2002-11-26 18:38 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-11-26 17:41 exec problem x x
2002-11-26 18:38 ` John Buttery
  -- strict thread matches above, loose matches on Subject: below --
2002-11-26 13:31 x x
2002-11-26 16:55 ` John Buttery
2002-11-26 17:51 ` Dan Nelson

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).