diff --git a/etc/MAKEDEV.tmpl b/etc/MAKEDEV.tmpl index a5afa47d330e..ded306ac458d 100644 --- a/etc/MAKEDEV.tmpl +++ b/etc/MAKEDEV.tmpl @@ -1,5 +1,5 @@ #!/bin/sh - -# $NetBSD: MAKEDEV.tmpl,v 1.104 2008/04/09 20:19:15 apb Exp $ +# $NetBSD: MAKEDEV.tmpl,v 1.105 2008/04/15 09:52:41 apb Exp $ # # Copyright (c) 2003,2007,2008 The NetBSD Foundation, Inc. # All rights reserved. @@ -361,8 +361,13 @@ linecount() # nooutput -12 cmd [args...] # run a command with stdout and/or stderr ignored. -# "nooutput -2 cmd" is like "cmd 2>/dev/null", -# except it should work even if /dev/null doesn't [yet] exist. +# "nooutput -1 cmd" is like "cmd >/dev/null"; +# "nooutput -2 cmd" is like "{ cmd ; } 2>/dev/null"; +# "nooutput -12 cmd" is like "{ cmd ; } >/dev/null 2>&1"; +# except they should work even if /dev/null doesn't [yet] exist. +# +# The "{...}" wrapper used in cases where stderr is redirected +# serves to capture shell error messages such as "cmd: not found". # nooutput() { @@ -370,8 +375,8 @@ nooutput() local junk case "$flags" in "-1") junk="$( "$@" )" ;; - "-2") exec 4>&1 ; junk="$( "$@" 2>&1 1>&4 )" ; exec 4>&- ;; - "-12") junk="$( "$@" 2>&1 )" ;; + "-2") exec 4>&1 ; junk="$( { "$@" ; } 2>&1 1>&4 )" ; exec 4>&- ;; + "-12") junk="$( { "$@" ; } 2>&1 )" ;; *) warn "Incorrect use of nooutput" ;; esac }