X-Recipient: archive-cygwin@delorie.com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
	:list-unsubscribe:list-subscribe:list-archive:list-post
	:list-help:sender:to:from:subject:date:message-id:references
	:mime-version:content-type; q=dns; s=default; b=YUYshNRE8uB0BpOi
	5SCZMBHGrIVU7d8lhFekyAeg6YaUivmqrJCrkcpjoXCXcrktoS5fD3HQa1gs+zMl
	9xjuVgyUt5W1j73jugbDznVKCUWXaltmVPA4hQqtTzN8JMWSaVYxMMdB2c/6tVLm
	fZtEwylUuD4OTWHJffSEsP3Hnko=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
	:list-unsubscribe:list-subscribe:list-archive:list-post
	:list-help:sender:to:from:subject:date:message-id:references
	:mime-version:content-type; s=default; bh=rcdP7gNwBZ0mvr49OcyAmi
	eNa2k=; b=tDnPE/SpabdX4H3Voztt5wTPyFMW/WX5O/HAQ9qm/8keq+0SMkiNtT
	l4AqBAMZ/imEsEAchqymmgmVFdPTKl5MhKD5XGrmovm14YKvwpIUMeECzb0wJd77
	0CnJdWH/Gu+cb9cTPk+XmMAqJ7CEPEQZTNKG8l/uUkNitPcTMIzeQ=
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=1.8 required=5.0 tests=BAYES_40,FREEMAIL_FROM,KAM_LAZY_DOMAIN_SECURITY,KAM_OTHER_BAD_TLD autolearn=no version=3.3.2 spammy=mintty, stealing, keyboard, Scheduler
X-HELO: blaine.gmane.org
To: cygwin@cygwin.com
From: Oleksandr Gavenko <gavenkoa@gmail.com>
Subject: Re: Hiding console when running Cygwin utility from Task Scheduler.
Date: Thu, 03 Aug 2017 14:42:46 +0300
Lines: 65
Message-ID: <861sosx4g9.fsf@gavenkoa.example.com>
References: <86o9ryymx5.fsf@gavenkoa.example.com>	<a547973c-5175-9dc8-1b8a-55635e73983b@SystematicSw.ab.ca>	<8660e5wnb6.fsf@gavenkoa.example.com>	<f5574d4f-6edd-d179-f4fc-5fff611eaa70@SystematicSw.ab.ca>
Mime-Version: 1.0
Content-Type: text/plain
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (windows-nt)
X-IsSubscribed: yes

On 2017-08-02, Brian Inglis wrote:

> I believe that conhost, mintty, ptys, cron, and Cygwin program startup open
> handles for stdin, stdout, stderr to talk on, as those are assumed to be
> available by most programs, rather than closing anything, which could terminate
> program execution.
>
Small correction about `conhost`:

https://blogs.technet.microsoft.com/askperf/2009/10/05/windows-7-windows-server-2008-r2-console-host/
https://blogs.msdn.microsoft.com/reiley/2012/09/13/windows-8-and-conhost-exe/

It is native Windows app. I believe that it is responsible to drawing native
console and I want to hide it.

> Cygwin run allows you to run a Windows GUI program with a hidden console window.
>
I think situation a bit different. run.exe is able to "hide" console of
console app. Cygwin compiles each app as console as GUI app have no access to
stdin/stdout and can't attach to any console, as state run(1):

      Windows programs are either GUI programs or console programs. When
      started console programs will either attach to an existing console or
      create a new one. GUI programs can never attach to an exiting console.
      There is no way to attach to an existing console but hide it if started
      as GUI program.

>> My goal to avoid any splashes on screen and possible keyboard focus stealing
>> from sudden task execution.
>
> I never see any windows or conhost processes running Cygwin Scheduled Tasks with
> the previous suggestions and these settings:
>
>>> You may also have to set the (o) Run whether user is logged on or not
>>> radio button, [X] Do not store password..., and [X] Run with highest
>>> privileges check boxes.
>
> where the first may be most significant in this case;

Thanks! That is. When I change from:

 [x] run only when user logged in

to:

 [x] run whether user is logged on or not

I don't see that temporary console window.


I was going to check what happen with Cygwin app launched from nssm and see
comment:

  2017-04-26: Users of Windows 10 Creators Update should use prelease build
  2.2.4-101 to avoid an issue with services failing to start. If for some
  reason you cannot use that build you can also set AppNoConsole=1 in the
  registry, noting that applications which expect a console window may behave
  unexpectedly.

  https://nssm.cc/download

So Microsoft recently changed something in its console related API...

-- 
http://defun.work/


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

