f02bb3ce9489bb2c922188ebf94f52a0e80dd757 braney Mon Jul 5 10:45:34 2021 -0700 change system() calls to pipeline() calls. diff --git src/hg/hgGene/rnaStructure.c src/hg/hgGene/rnaStructure.c index dcfaec7..24c9684 100644 --- src/hg/hgGene/rnaStructure.c +++ src/hg/hgGene/rnaStructure.c @@ -1,30 +1,31 @@ /* rnaStructure - do section on 3' and 5' UTR structure. */ /* Copyright (C) 2014 The Regents of the University of California * See README in this or parent directory for licensing information. */ #include "common.h" #include "hash.h" #include "linefile.h" #include "jksql.h" #include "rnaFold.h" #include "hui.h" #include "web.h" #include "portable.h" #include "hgGene.h" #include "hgConfig.h" +#include "pipeline.h" static void rnaTrashDirsInit(char **tables, int count) /* create trash directories if necessary */ { for ( count--; count > -1; count--) mkdirTrashDirectory(tables[count]); } static boolean rnaStructureExists(struct section *section, struct sqlConnection *conn, char *geneId) /* Return TRUE if tables exists and have our gene. */ { if (sqlTableExists(conn, "foldUtr3") && sqlRowExists(conn, "foldUtr3", "name", geneId)) @@ -212,32 +213,36 @@ } else if (sameString(how, "picture")) { char *psFile = cartString(cart, hggMrnaFoldPs); char *rootName = cloneString(psFile); char pngName[256]; char pdfName[256]; chopSuffix(rootName); safef(pngName, sizeof(pngName), "%s.png", rootName); safef(pdfName, sizeof(pngName), "%s.pdf", rootName); hPrintf("

%s (%s) %s energy %1.2f

\n", geneName, geneId, table, fold->energy); if (!fileExists(pdfName)) { - char command[512]; - safef(command, sizeof(command), "ps2pdf %s %s" , psFile, pdfName); - mustSystem(command); + char *command[] = { "ps2pdf", psFile, pdfName, NULL}; + struct pipeline *pl = pipelineOpen1(command, pipelineWrite | pipelineNoAbort, "/dev/null", NULL); + int sysRet = pipelineWait(pl); + if (sysRet != 0) + errAbort("System call returned %d for:\n %s", sysRet, pipelineDesc(pl)); } hPrintf("Click here for PDF version
", pdfName); if (!fileExists(pngName)) { - char command[512]; - safef(command, sizeof(command), - "gs -sDEVICE=png16m -sOutputFile=%s -dBATCH -dNOPAUSE -q %s" - , pngName, psFile); - mustSystem(command); + char outputBuf[1024]; + safef(outputBuf, sizeof outputBuf, "-sOutputFile=%s", pngName); + char *command[] = { "gs","-sDEVICE=png16m", outputBuf,"-dBATCH","-dNOPAUSE","-q", psFile, NULL}; + struct pipeline *pl = pipelineOpen1(command, pipelineWrite | pipelineNoAbort, "/dev/null", NULL); + int sysRet = pipelineWait(pl); + if (sysRet != 0) + errAbort("System call returned %d for:\n %s", sysRet, pipelineDesc(pl)); } hPrintf("", pngName); } }