Deutsch English Français Italiano |
<lfr2iaFt3q5U3@mid.individual.net> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: rbowman <bowman@montana.com> 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: <lfr2iaFt3q5U3@mid.individual.net> References: <v71fcn$ah31$1@dont-email.me> <memo.20240714223824.14216Q@jgd.cix.co.uk> <v71tga$cpvf$1@dont-email.me> <slrnv9cmi1.5oqr.rotflol2@geidiprime.bvh> <wwvy1612j5b.fsf@LkoBDZeT.terraraq.uk> <v79ho6$21urb$1@dont-email.me> 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) Bytes: 1859 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.