In the nooutput function, use {...} to ensure that shell messages
like "cmd: not found" are also redirected. This should fix a problem reported by Chavdar Ivanov in which the message "mtree: not found" appears during installation.
This commit is contained in:
parent
1121526b25
commit
0a0e65b2a1
@ -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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user