Date: Wed, 15 Feb 2012 17:10:09 -0800 From: Xin Li <delphij@delphij.net> To: freebsd-rc@FreeBSD.org Cc: d@delphij.net Subject: [PATCH FOR REVIEW] rc.subr: use stderr instead of stdout for trap handlers Message-ID: <4F3C5771.2030202@delphij.net>
next in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format. --------------090601020002040109050308 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 Hi, Currently if certain signals is received, rc.subr's trap instruction would inject output to standard output. This could be a problem if the script uses standard output for other purposes, e.g. generating a configuration file, etc. The proposed change redirects these information to standard error. Objections? Cheers, - -- Xin LI <delphij@delphij.net> https://www.delphij.net/ FreeBSD - The Power to Serve! Live free or die -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.18 (FreeBSD) iQEcBAEBCAAGBQJPPFdxAAoJEG80Jeu8UPuzyksH/jZH6o5C3jBSarSSElKyU42A k1Wrz7GUdp36cQBIGHw0dZsEOZmMS5r6IghztLPZwO4H+1yJEae4tvkUJK2V+6t5 yBptnyzYbtAr0ns4/ntnfNJgk8NyQER4F0U5txzQgIAHhrhNPSJUr5assziU1AaN VjOpKyysBcd5btLwLfLwVwcZrwListL8YdN1CrRN2LAHY+Y9dFOYeqeIWp2vVA61 o7aegzN9hk2zr4byuoA+cyyqqWCmw4xcSEPYB3nXU3GPwGsCpp0vlXtjUIBGeGnJ +ooI+MfBVyVxnR3PJR4hleq2BiBEYtGzYt2aXd9lHGMBA/ZJL1m3t7GpvwIfCDA= =Vmmg -----END PGP SIGNATURE----- --------------090601020002040109050308 Content-Type: text/plain; name="rc.subr.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="rc.subr.diff" Index: etc/rc.subr =================================================================== --- etc/rc.subr (revision 231173) +++ etc/rc.subr (working copy) @@ -978,9 +978,9 @@ if [ -n "$rc_fast_and_loose" ]; then set $_arg; . $_file else - ( trap "echo Script $_file interrupted; kill -QUIT $$" 3 - trap "echo Script $_file interrupted; exit 1" 2 - trap "echo Script $_file running" 29 + ( trap "echo Script $_file interrupted >&2 ; kill -QUIT $$" 3 + trap "echo Script $_file interrupted >&2 ; exit 1" 2 + trap "echo Script $_file running >&2" 29 set $_arg; . $_file ) fi fi --------------090601020002040109050308--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4F3C5771.2030202>