Path: csiph.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: rbowman Newsgroups: comp.os.linux.misc Subject: Re: What programs do you make sure are installed on a new Linux Date: 17 Jul 2024 23:31:22 GMT Lines: 28 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Trace: individual.net AK/9rzxZYjiq8SR6JK9wjAGF4JT4Jr6lkvSpwEDWVGhz4xCbeX Cancel-Lock: sha1:9fNxphopp98gL5KBdn82xT/760o= sha256:nVHBSWJn0J7qTcnsYtBuM3+A7W68efAbgnFXByf6jKc= User-Agent: Pan/0.149 (Bellevue; 4c157ba) Xref: csiph.com comp.os.linux.misc:56997 On Wed, 17 Jul 2024 22:48:39 -0000 (UTC), Lawrence D'Oliveiro wrote: > Another weird distinction: non-console applications don’t get any > standard input/output/error streams, and will abort if they try to > access them I can't address what goes on in pythonw but in a straight service [DllImport("kernel32.dll")] static extern bool AttachConsole(int dwProcessId); private const int ATTACH_PARENT_PROCESS = -1; static void Main() { string[] args = Environment.GetCommandLineArgs(); foreach (string arg in args) { if (arg == "-v") { AttachConsole(ATTACH_PARENT_PROCESS); Console.WriteLine("{0} version {1}", Assembly.GetExecutingAssembly().GetName().Name, Assembly.GetExecutingAssembly().GetName().Version); return; } } works nicely if you want to print the version and exit rather than running the service.