From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22746 invoked by alias); 23 Jan 2016 13:05:22 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 22730 invoked by uid 89); 23 Jan 2016 13:05:21 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: Yes, score=5.8 required=5.0 tests=AWL,BAYES_50,FREEMAIL_FROM,KAM_THEBAT,RCVD_IN_PSBL,SPF_SOFTFAIL autolearn=no version=3.3.2 spammy=H*UA:Bat!, H*x:Bat!, H*UA:Home, H*x:Home X-HELO: smtp.ht-systems.ru Received: from smtp.ht-systems.ru (HELO smtp.ht-systems.ru) (78.110.50.177) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Sat, 23 Jan 2016 13:05:19 +0000 Received: from [95.165.144.62] (helo=darkdragon.lan) by smtp.ht-systems.ru with esmtpa (Exim 4.80.1) (envelope-from ) (Authenticated sender: postmaster@rootdir.org) id 1aMxsP-0002p3-Iq ; Sat, 23 Jan 2016 16:05:14 +0300 Received: from [192.168.1.10] (HELO daemon2.darkdragon.lan) by daemon2 (Office Mail Server 0.8.12 build 08053101) with SMTP; Sat, 23 Jan 2016 12:52:24 -0000 Date: Sat, 23 Jan 2016 15:21:00 -0000 From: Andrey Repin Reply-To: cygwin@cygwin.com Message-ID: <862202948.20160123155224@yandex.ru> To: Kenneth Wolcott , cygwin@cygwin.com Subject: Re: Using Perl on Cygwin; how to prevent display of unwanted usage/error message? In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2016-01/txt/msg00310.txt.bz2 Greetings, Kenneth Wolcott! > I'm using a qx call to "net user username /DOMAIN" (probably should > use system instead) to determine whether a person having an active > account in an application is still an employee. > I get two messages back (error and/or usage) when a username is not found. > "The user name could not be found." > and > "More help is available by typing NET HELPMSG 2221." > I'd like to hide (not display, not print) these two messages. > Coming from a UNIX/Linux background, I'd do a "2>&1 > /dev/null" > operation to dispose of STDOUT and STDERR, but "1<&2 > NUL" (suggested > by > "https://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/redirection.mspx?mfr=true" > does not seem to work. That's... I don't know how to qualify this article, but it's just doesn't quite work that way. The semantics of redirection are same on Windows as on Linux. net user username /DOMAIN > /dev/null 2>&1 or, under native shell (cmd) net user username /DOMAIN > nul: 2>&1 > I tried file descriptor 3, but that resulted in an error regarding > unsupported file handle,. or something like that. > I was considering using IPC::Run3, but I don't think that will help > with suppressing error message and usage message. > Perhaps there is a Perl module that is native to Cygwin that will > perform this kind of lookup for me? Maybe a Perl module that is NOT > native to Cygwin? Another solution is to assign your own handles to the underlying process, but considering you don't want the output at all, I don't see it viable. -- With best regards, Andrey Repin Saturday, January 23, 2016 15:42:00 Sorry for my terrible english... -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple