4627c107f20b2ff3969114bcb619a0d02c0258a6 braney Fri Jul 9 12:58:00 2021 -0700 replace a couple of calls to popen() with pipeline() diff --git src/hg/hgc/rnaFoldClick.c src/hg/hgc/rnaFoldClick.c index c200fdb..f758e76 100644 --- src/hg/hgc/rnaFoldClick.c +++ src/hg/hgc/rnaFoldClick.c @@ -376,37 +376,39 @@ // grab the sequence struct dnaSeq *seq = hChromSeq(database, item->chrom, item->chromStart, item->chromEnd); touppers(seq->dna); if (item->strand[0] == '-') reverseComplement(seq->dna, seq->size); toRna(seq->dna); // make sure the dna is not longer than the paren string seq->dna[strlen(item->secStr)] = 0; char *rnaPlotPath = cfgOptionDefault("rnaPlotPath", "../cgi-bin/RNAplot"); mkdirTrashDirectory(table); char psName[512]; safef(psName, sizeof(psName), "../trash/%s/%s_%s.ps", table, table, item->name); -FILE *of = popen(rnaPlotPath, "w"); +char *plotCmd[] = {rnaPlotPath, NULL}; +struct pipeline *plStruct = pipelineOpen1(plotCmd, pipelineWrite | pipelineNoAbort, "/dev/null", NULL); +FILE *of = pipelineFile(plStruct); if (of != NULL) { fprintf(of, ">%s\n", psName); /* This tells where to put file. */ fprintf(of, "%s\n%s\n", seq->dna, item->secStr); - pclose(of); } +pipelineClose(&plStruct); char pngName[256]; char *rootName = cloneString(psName); chopSuffix(rootName); safef(pngName, sizeof(pngName), "%s.png", rootName); char outputBuf[1024]; safef(outputBuf, sizeof outputBuf, "-sOutputFile=%s", pngName); char *pipeCmd[] = {"gs", "-sDEVICE=png16m", outputBuf, "-dBATCH","-dNOPAUSE","-q", psName, NULL}; struct pipeline *pl = pipelineOpen1(pipeCmd, pipelineWrite | pipelineNoAbort, "/dev/null", NULL); int sysRet = pipelineWait(pl); if (sysRet != 0) errAbort("System call returned %d for:\n %s", sysRet, pipelineDesc(pl));