095cba23003b6d1f0a1ebc772c44a15c03b9d5d8
angie
  Fri Feb 21 10:20:38 2020 -0800
start textOut pipe earlier in case there are warnings from loading trackDb.  refs #25003

diff --git src/hg/hgIntegrator/hgIntegrator.c src/hg/hgIntegrator/hgIntegrator.c
index 9c3e46e..070940e 100644
--- src/hg/hgIntegrator/hgIntegrator.c
+++ src/hg/hgIntegrator/hgIntegrator.c
@@ -865,42 +865,43 @@
 //#*** TODO: improve user-defined regions:
 //#*** For starters, just loop the whole damn thing on regions just like the TB.
 //#*** It would be better for performance to push the details of per-chrom files
 //#*** or split tables down into streamers, which could then open a different
 //#*** file or db table when a new minChrom is passed in or when streamer->setRegion
 //#*** is called.
 
 // Decode and parse CGI-encoded querySpec.
 char *querySpec = cartString(cart, QUERY_SPEC);
 int len = strlen(querySpec);
 char querySpecDecoded[len+1];
 cgiDecodeFull(querySpec, querySpecDecoded, len);
 struct jsonElement *queryObj = jsonParse(querySpecDecoded);
 struct slRef *dataSources = jsonListVal(jsonFindNamedField(queryObj, "queryObj", "dataSources"),
                                         "dataSources");
+// Set up output.
+int savedStdout = -1;
+struct pipeline *textOutPipe = configTextOut(queryObj, &savedStdout);
+webStartText();
+
 // Get trackDb, assembly and regionList.
 struct trackDb *fullTrackList = getFullTrackList(cart);
 char *db = cartString(cart, "db");
 initGenbankTableNames(db);
 struct annoAssembly *assembly = hAnnoGetAssembly(db);
 char regionDesc[PATH_LEN];
 struct bed4 *regionList = getRegionList(db, dataSources, fullTrackList,
                                         regionDesc, sizeof(regionDesc));
-// Set up output.
-int savedStdout = -1;
-struct pipeline *textOutPipe = configTextOut(queryObj, &savedStdout);
-webStartText();
 // Print a simple output header
 time_t now = time(NULL);
 printf("# hgIntegrator: database=%s region=%s %s", db, regionDesc, ctime(&now));
 // Make an annoFormatter to print output.
 // For now, tab-separated output is it.
 struct annoFormatter *formatter = makeTabFormatter(queryObj);
 
 // For now, do a complete annoGrator query for each region, rebuilding each data source
 // since annoStreamers don't yet handle split tables/files internally.  For decent
 // performance, it will be necessary to push split-source handling inside the streamers,
 // and then all we'll need to do is make one set of streamers and then loop only on calls
 // to annoGratorQuerySetRegion and annoGratorQueryExecute.
 boolean userDefinedRegions = sameString(hgtaRegionTypeUserRegions,
                                         cartUsualString(cart, hgiRegionType, hgiRegionTypeDefault));
 struct bed4 *region;