6f949e90b1ba3de976455fbcf9da21897761d134 markd Fri Oct 29 16:11:58 2021 -0700 add timeout option to pipeline to allow kill long-running pipelines, especially ones run from CGIs diff --git src/lib/linefile.c src/lib/linefile.c index 3e12bcc..a7f8834 100644 --- src/lib/linefile.c +++ src/lib/linefile.c @@ -134,58 +134,58 @@ { struct pipeline *pl; struct lineFile *lf; char *testName = NULL; char *testbytes = NULL; /* the header signatures for .gz, .bz2, .Z, * .zip are all 2-4 bytes only */ if (fileName==NULL) return NULL; testbytes=headerBytes(fileName,4); if (!testbytes) return NULL; /* avoid error from pipeline */ testName=getFileNameFromHdrSig(testbytes); freez(&testbytes); if (!testName) return NULL; /* avoid error from pipeline */ -pl = pipelineOpen1(getDecompressor(fileName), pipelineRead|pipelineSigpipe, fileName, NULL); +pl = pipelineOpen1(getDecompressor(fileName), pipelineRead|pipelineSigpipe, fileName, NULL, 0); lf = lineFileAttach(fileName, zTerm, pipelineFd(pl)); lf->pl = pl; return lf; } struct lineFile *lineFileDecompressFd(char *name, bool zTerm, int fd) /* open a linefile with decompression from a file or socket descriptor */ { struct pipeline *pl; struct lineFile *lf; -pl = pipelineOpenFd1(getDecompressor(name), pipelineRead|pipelineSigpipe, fd, STDERR_FILENO); +pl = pipelineOpenFd1(getDecompressor(name), pipelineRead|pipelineSigpipe, fd, STDERR_FILENO, 0); lf = lineFileAttach(name, zTerm, pipelineFd(pl)); lf->pl = pl; return lf; } struct lineFile *lineFileDecompressMem(bool zTerm, char *mem, long size) /* open a linefile with decompression from a memory stream */ { struct pipeline *pl; struct lineFile *lf; char *fileName = getFileNameFromHdrSig(mem); if (fileName==NULL) return NULL; -pl = pipelineOpenMem1(getDecompressor(fileName), pipelineRead|pipelineSigpipe, mem, size, STDERR_FILENO); +pl = pipelineOpenMem1(getDecompressor(fileName), pipelineRead|pipelineSigpipe, mem, size, STDERR_FILENO, 0); lf = lineFileAttach(fileName, zTerm, pipelineFd(pl)); lf->pl = pl; return lf; } struct lineFile *lineFileAttach(char *fileName, bool zTerm, int fd) /* Wrap a line file around an open'd file. */ { struct lineFile *lf; AllocVar(lf); lf->fileName = cloneString(fileName); lf->fd = fd; lf->bufSize = 64*1024;