f02bb3ce9489bb2c922188ebf94f52a0e80dd757 braney Mon Jul 5 10:45:34 2021 -0700 change system() calls to pipeline() calls. diff --git src/hg/hgc/barChartClick.c src/hg/hgc/barChartClick.c index f12fb48..3775785 100644 --- src/hg/hgc/barChartClick.c +++ src/hg/hgc/barChartClick.c @@ -347,52 +347,48 @@ struct barChartCategory *categ; fprintf(f, "%s\t%s\n", "category", "color"); for (categ = categs; categ != NULL; categ = categ->next) { //fprintf(f, "%s\t#%06X\n", categ->label, categ->color); fprintf(f, "%s\t%d\n", categ->label, categ->color); } fclose(f); return cloneString(colorTn.forCgi); } static void printBoxplot(char *df, char *item, char *name2, char *units, char *colorFile) /* Plot data frame to image file and include in HTML */ { struct tempName pngTn; -struct dyString *cmd = dyStringNew(0); trashDirFile(&pngTn, "hgc", "barChart", ".png"); // to help with QAing the change, we add the "oldFonts" CGI parameter so QA can compare // old and new fonts to make sure that things are still readible on mirrors and servers // without the new fonts installed. This only needed during the QA phase bool useOldFonts = cgiBoolean("oldFonts"); /* Exec R in quiet mode, without reading/saving environment or workspace */ char *pipeCmd[] = {"Rscript","--vanilla","--slave","hgcData/barChartBoxplot.R", item, units, colorFile, df, pngTn.forHtml, - isEmpty(name2) ? "n/a" : name2, useOldFonts ? "1" : "0"}; + isEmpty(name2) ? "n/a" : name2, useOldFonts ? "1" : "0", NULL}; struct pipeline *pl = pipelineOpen1(pipeCmd, pipelineWrite | pipelineNoAbort, "/dev/null", NULL); int ret = pipelineWait(pl); -/* put command in string in case of error. */ -dyStringPrintf(cmd, "Rscript --vanilla --slave hgcData/barChartBoxplot.R %s '%s' %s %s %s %s %d", - item, units, colorFile, df, pngTn.forHtml, isEmpty(name2) ? "n/a" : name2, useOldFonts); if (ret == 0) printf("
\n", pngTn.forHtml); else - warn("Error creating boxplot from sample data with command: %s", cmd->string); + warn("Error creating boxplot from sample data with command: %s", pipelineDesc(pl)); } static double estimateStringWidth(char *s) /* Get estimate of string width based on a memory font that is about the * same size as svg will be using. After much research I don't think we * can get the size from the server, would have to be in Javascript to get * more precise */ { MgFont *font = mgHelvetica14Font(); return mgFontStringWidth(font, s); } static double longestLabelSize(struct barChartCategory *categList) /* Get estimate of longest label in pixels */ {