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/dnaMotif.c src/lib/dnaMotif.c index 817a241..4d74c9e 100644 --- src/lib/dnaMotif.c +++ src/lib/dnaMotif.c @@ -534,31 +534,31 @@ /* Write logo corresponding to motif to png file. */ { char *psName = rTempName(tempDir, "dnaMotif", ".ps"); int w, h; int sysRet; if (gsExe == NULL) gsExe = "gs"; if (tempDir == NULL) tempDir = "/tmp"; dnaMotifToLogoPs(motif, widthPerBase, height, psName); dnaMotifDims(motif, widthPerBase, height, &w, &h); char geoBuf[1024]; safef(geoBuf, sizeof geoBuf, "-g%dx%d", w, h); char outputBuf[1024]; safef(outputBuf, sizeof outputBuf, "-sOutputFile=%s", fileName); char *pipeCmd[] = {gsExe, "-sDEVICE=png16m", outputBuf, "-dBATCH","-dNOPAUSE","-q", geoBuf, psName, NULL}; -struct pipeline *pl = pipelineOpen1(pipeCmd, pipelineWrite | pipelineNoAbort, "/dev/null", NULL); +struct pipeline *pl = pipelineOpen1(pipeCmd, pipelineWrite | pipelineNoAbort, "/dev/null", NULL, 0); sysRet = pipelineWait(pl); if (sysRet != 0) errAbort("System call returned %d for:\n %s", sysRet, pipelineDesc(pl)); remove(psName); } void dnaMotifToLogoPsW(struct dnaMotif *motif, double widthPerBase, double width, double height, char *fileName) /* Write logo corresponding to motif to postScript file. */ { FILE *f = mustOpen(fileName, "w"); int i; int xStart = 0; int w, h; char *s = @@ -593,23 +593,23 @@ /* Write logo corresponding to motif to pgm file. */ { char *psName = rTempName(tempDir, "dnaMotif", ".ps"); int w, h; int sysRet; if (gsExe == NULL) gsExe = "gs"; if (tempDir == NULL) tempDir = "/tmp"; dnaMotifToLogoPsW(motif, widthPerBase, width, height, psName); dnaMotifDims(motif, widthPerBase, height, &w, &h); char geoBuf[1024]; safef(geoBuf, sizeof geoBuf, "-g%dx%d ", (int) ceil(width), h); char outputBuf[1024]; safef(outputBuf, sizeof outputBuf, "-sOutputFile=%s", fileName); char *pipeCmd[] = {gsExe, "-sDEVICE=pgmraw", outputBuf, "-dBATCH","-dNOPAUSE","-q", geoBuf, psName, NULL}; -struct pipeline *pl = pipelineOpen1(pipeCmd, pipelineWrite | pipelineNoAbort, "/dev/null", NULL); +struct pipeline *pl = pipelineOpen1(pipeCmd, pipelineWrite | pipelineNoAbort, "/dev/null", NULL, 0); sysRet = pipelineWait(pl); if (sysRet != 0) errAbort("System call returned %d for:\n %s", sysRet, pipelineDesc(pl)); remove(psName); }