public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Oleksandr Gavenko <gavenkoa@gmail.com>
To: cygwin@cygwin.com
Subject: Re: Hiding console when running Cygwin utility from Task Scheduler.
Date: Wed, 02 Aug 2017 23:41:00 -0000	[thread overview]
Message-ID: <8660e5wnb6.fsf@gavenkoa.example.com> (raw)
In-Reply-To: <a547973c-5175-9dc8-1b8a-55635e73983b@SystematicSw.ab.ca>

On 2017-08-02, Brian Inglis wrote:

> Redirect all stdin from /dev/null, stdout, stderr to a log file in your script ,
> like:
> 	#!/bin/bash
> 	prog=${0##*/}
> 	base=${prog%.*}
> 	log=/var/log/$base.log
>
> 	# do everything inside this wrapper
> 	{
> 		...
> 	} < /dev/null &> $log
>
> or equivalent on each command if you don't have many.

That is not the case for:

> How can I prevent console to be shown when bash started from Task Scheduler?

Closing of stdin / stdout / stderr is task for external process (like CRON)
even on UNIX.

With simple:

  #include <stdio.h>
  #include <unistd.h>

  int main(int argc, char **argv) {
      fclose(stdin);
      fclose(stdout);
      fclose(stderr);

      sleep(10);

      return 0;
  }

in Task Scheduler I see console window and supporting conhost.exe process.

OK. I know about run.exe from package:

  run
  sdesc: "Launch cmdline programs with hidden console"
  ldesc: "Launch cmdline programs with hidden console"
  category: Base
  requires: cygwin
  version: 1.3.4-2

I tried:

  $ cp /bin/run.exe ~/usr/bin/runbash.exe

and provide path to ~/usr/bin/runbash.exe in Task Scheduler. Console window
still flashes.

With my tiny test utility:

  $ cp /bin/run.exe ~/usr/bin/runxtest.exe

it flashes too from Task Scheduler but for a moment not 10 sec ))

Same if I run by Win+R:

  $ run xtest

My goal to avoid any splashes on screen and possible keyboard focus stealing
from sudden task execution.

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

  reply	other threads:[~2017-08-02 23:41 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-02 16:06 Oleksandr Gavenko
2017-08-02 19:21 ` Brian Inglis
2017-08-02 23:41   ` Oleksandr Gavenko [this message]
2017-08-03  5:21     ` Brian Inglis
2017-08-03 11:43       ` Oleksandr Gavenko
2017-08-03 13:05         ` cyg Simple
2017-08-03 14:09           ` Oleksandr Gavenko
2017-08-07 17:05 ` Andrey Repin
2017-08-07 17:36   ` Oleksandr Gavenko
2017-08-08  0:05     ` 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=8660e5wnb6.fsf@gavenkoa.example.com \
    --to=gavenkoa@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).