Mail Archives: cygwin-developers/2001/08/22/04:20:13
Hi!
Wednesday, 22 August, 2001 Kazuhiro Fujieda fujieda AT jaist DOT ac DOT jp wrote:
>>>> On Wed, 22 Aug 2001 09:17:49 +0200
>>>> Corinna Vinschen <vinschen AT redhat DOT com> said:
>> Kazuhiro, did you find your original problem only with inetd
>> and cygrunsrv or even when the process has been started by
>> SRVANY???
KF> My original problem is that sshd and inetd can't work without
KF> the console window when I execute it not as a service but as an
KF> normal application.
KF> For example, if you execute sshd via the startup shortcut, the
KF> console window pops up and remains until it is terminated by
KF> SIGTERM. If you execute it on a shell prompt and terminate the
KF> shell, the console window of the shell also remains.
i use this simple program in such cases.
#include <windows.h>
#define TITLESIZE 1024
int
main (int argc, char** argv)
{
HWND console;
char old_title [TITLESIZE];
char new_title [TITLESIZE];
if (!GetConsoleTitle (old_title, TITLESIZE))
return 1;
sprintf (new_title, "cygwin.hide.%d", GetCurrentProcessId ());
SetConsoleTitle (new_title);
Sleep (40);
console = FindWindow (NULL, new_title);
SetConsoleTitle (old_title);
ShowWindow (console, SW_HIDE);
}
maybe we can add something like this to cygwin api? besides, cygwin
already has console handle, so title stuff won't be necessary.
>> Perhaps we should add a switch to cygrunsrv whether it should call
>> AllocConsole() or not?!?
KF> I think inetd and cygrunsrv shouldn't invoke AllocConsole() and
KF> the problem with windows popping up should be solved by Egor's
KF> ttyfier.
ttyfier is designed to run interactive applications. if you want to
run, say, 'net start some_service', which creates new console in case
it's not available, it's fine. but if you'll run it with redirected
output, e.g 'tfy net start some_service >> service.log', you won't see
in service.log what you should normally expect.
Egor. mailto:deo AT logos-m DOT ru ICQ 5165414 FidoNet 2:5020/496.19
- Raw text -