f02bb3ce9489bb2c922188ebf94f52a0e80dd757
braney
  Mon Jul 5 10:45:34 2021 -0700
change system() calls to pipeline() calls.

diff --git src/hg/hgc/rnaFoldClick.c src/hg/hgc/rnaFoldClick.c
index 5d8804f..c200fdb 100644
--- src/hg/hgc/rnaFoldClick.c
+++ src/hg/hgc/rnaFoldClick.c
@@ -6,30 +6,31 @@
 #include "common.h"
 #include "jksql.h"
 #include "hgMaf.h"
 #include "maf.h"
 #include "cart.h"
 #include "hgc.h"
 #include "hCommon.h"
 #include "hgColors.h"
 #include "obscure.h"
 #include "customTrack.h"
 #include "htmshell.h"
 #include "rnautil.h"
 #include "rnaSecStr.h"
 #include "memalloc.h"
 #include "hgConfig.h"
+#include "pipeline.h"
 
 
 /* Taken from hgc.c (should probably be in hgc.h)*/
 #define RED 0xFF0000
 #define GREEN 0x00FF00
 #define BLUE 0x0000FF
 #define BLACK 0x000000
 #define CYAN 0x00FFFF
 #define GRAY 0xcccccc
 #define LTGRAY 0x999999
 #define ORANGE 0xDD6600
 #define MAGENTA 0xFF00FF
 
 #define LTPURPLE 0x9966CC
 #define SCORE_SHADES_COUNT 10
@@ -373,50 +374,53 @@
 /* Print out the details for an rnaStruct* table. */
 {
 // 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 command[512];
 char psName[512];
 safef(psName, sizeof(psName), "../trash/%s/%s_%s.ps", table, table, item->name);
 FILE *of = popen(rnaPlotPath, "w");
 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);
     }
 
 char pngName[256];
 char *rootName = cloneString(psName);
  
 chopSuffix(rootName);
 safef(pngName, sizeof(pngName), "%s.png", rootName);
 
-safef(command, sizeof(command),
-    "gs -g768x768 -sDEVICE=png16m -sOutputFile=%s -dBATCH -dNOPAUSE -q %s" , pngName, psName);
-mustSystem(command);
+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));
 
 printf("<a target=blank href='http://pseudoviewer.inha.ac.kr/WSPV_quickSender.asp?seq=%s&str=%s&start=%d'>Display on PseudoViewer</a><BR>", seq->dna, item->secStr, start);
 htmlHorizontalLine();
 printf("RNAFold diagram:<BR>");
 printf("<IMG SRC='%s' border = '2'>", pngName);
 }
 
 void htmlPrintSecStrEvofoldDrawing(FILE *f, struct rnaSecStr *item)
 {
 char fileName[512];
 struct dnaSeq *seq;
 seq = hChromSeq(database, item->chrom, item->chromStart, item->chromEnd);
 touppers(seq->dna);
 if (item->strand[0] == '-')
     reverseComplement(seq->dna, seq->size);