This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Mintty/tmux hangs for 1 minute on startup - seems to be a forking issue


On Sat, 1 Feb 2020 23:25:08 +0000 (UTC)
"Anon User via cygwin" wrote:
> $ md5sum /bin/cygwin-console-helper.exe
> 221bdfff7c8ccd1227bacb025bba665b */bin/cygwin-console-helper.exe

This is the right md5sum value.
Then, how about the attached test case?

-- 
Takashi Yano <takashi.yano@nifty.ne.jp>
#define _WIN32_WINNT 0x0a00
#include <windows.h>
#include <stdio.h>

typedef void *HPCON;
#ifndef PROC_THREAD_ATTRIBUTE_PSEUDOCONSOLE
#define PROC_THREAD_ATTRIBUTE_PSEUDOCONSOLE 0x00020016L
#endif
#ifndef ENABLE_VIRTUAL_TERMINAL_PROCESSING
#define ENABLE_VIRTUAL_TERMINAL_PROCESSING 0x0004
#endif

DWORD WINAPI PipeWriter(LPVOID pipe);
DWORD WINAPI PipeReader(LPVOID pipe);

int main()
{
	HMODULE h;
	FARPROC f;
	COORD size;
	HPCON hpCon;
	HANDLE inR, inW, outR, outW;
	HRESULT (WINAPI *CreatePseudoConsole)(COORD, HANDLE, HANDLE, DWORD, HPCON*);
	VOID (WINAPI *ClosePseudoConsole)(HPCON);

	h = GetModuleHandle("kernel32.dll");
	if (h == INVALID_HANDLE_VALUE) {
		fprintf(stderr, "GetModuleHandle() failed.\n");
		return 1;
	}
	f = GetProcAddress(h, "CreatePseudoConsole");
	if (f == NULL) {
		fprintf(stderr, "GetProcAddress() failed.\n");
		return 1;
	}
	CreatePseudoConsole = (HRESULT (WINAPI *)(COORD, HANDLE, HANDLE, DWORD, HPCON*))f;
	f = GetProcAddress(h, "ClosePseudoConsole");
	if (f == NULL) {
		fprintf(stderr, "GetProcAddress() failed.\n");
		return 1;
	}
	ClosePseudoConsole = (VOID (WINAPI *)(HPCON))f;
	CloseHandle(h);

	if (!CreatePipe(&inR, &inW, NULL, 0)) {
		fprintf(stderr, "CreatePipe() failed.\n");
		return 1;
	}
	if (!CreatePipe(&outR, &outW, NULL, 0)) {
		fprintf(stderr, "CreatePipe() failed.\n");
		return 1;
	}

	size.X = 80;
	size.Y = 24;

	printf("Started.\n");
	if (S_OK != CreatePseudoConsole(size, inR, outW, 0, &hpCon)) {
		fprintf(stderr, "CreatePseudoConsole() failed.\n");
		return 1;
	}
	printf("CreatePseudoConsole() end.\n");

	CloseHandle(inR);
	CloseHandle(outW);
	ClosePseudoConsole(hpCon);
	CloseHandle(inW);
	CloseHandle(outR);
	printf("ClosePseudoConsole() end.\n");

	return 0;
}

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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]