public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Kenneth Wolcott <kennethwolcott@gmail.com>
To: cygwin@cygwin.com
Subject: Using Perl on Cygwin; how to prevent display of unwanted usage/error message?
Date: Sat, 23 Jan 2016 12:59:00 -0000	[thread overview]
Message-ID: <CADex0xzfB3=aBJ7AgbTJ0hQKpmD0JSnX6xcjmu4fmqy284j5jw@mail.gmail.com> (raw)

Hi;

  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.

  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?

Thanks,
Ken Wolcott

--
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

             reply	other threads:[~2016-01-22 23:21 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-23 12:59 Kenneth Wolcott [this message]
2016-01-23 13:05 ` Erik Soderquist
2016-01-23 14:25   ` Kenneth Wolcott
2016-01-23 15:21 ` Andrey Repin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CADex0xzfB3=aBJ7AgbTJ0hQKpmD0JSnX6xcjmu4fmqy284j5jw@mail.gmail.com' \
    --to=kennethwolcott@gmail.com \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 read-only IMAP folder(s) and NNTP newsgroup(s).