in src/com/pty4j/windows/cygwin/CygwinPtyProcess.java [37:62]
public CygwinPtyProcess(String[] command, Map<String, String> environment, String workingDirectory, File logFile, boolean console)
throws IOException {
myConsoleMode = console;
String pipePrefix = String.format("\\\\.\\pipe\\cygwinpty-%d-%d-", Kernel32.INSTANCE.GetCurrentProcessId(), processCounter.getAndIncrement());
String inPipeName = pipePrefix + "in";
String outPipeName = pipePrefix + "out";
String errPipeName = pipePrefix + "err";
myInputHandle = CygwinKernel32.INSTANCE.CreateNamedPipeA(inPipeName, PIPE_ACCESS_OUTBOUND | WinNT.FILE_FLAG_OVERLAPPED, 0, 1, 0, 0, 0, null);
myOutputHandle = CygwinKernel32.INSTANCE.CreateNamedPipeA(outPipeName, PIPE_ACCESS_INBOUND | WinNT.FILE_FLAG_OVERLAPPED, 0, 1, 0, 0, 0, null);
myErrorHandle =
console ? CygwinKernel32.INSTANCE.CreateNamedPipeA(errPipeName, PIPE_ACCESS_INBOUND | WinNT.FILE_FLAG_OVERLAPPED, 0, 1, 0, 0, 0, null) : null;
if (myInputHandle == WinBase.INVALID_HANDLE_VALUE ||
myOutputHandle == WinBase.INVALID_HANDLE_VALUE ||
myErrorHandle == WinBase.INVALID_HANDLE_VALUE) {
closeHandles();
throw new IOException("Unable to create a named pipe");
}
myInputPipe = new NamedPipe(myInputHandle, false);
myOutputPipe = new NamedPipe(myOutputHandle, false);
myErrorPipe = myErrorHandle != null ? new NamedPipe(myErrorHandle, false) : null;
myProcess = startProcess(inPipeName, outPipeName, errPipeName, workingDirectory, command, environment, logFile, console);
}