cbf68227beab3cf1d923d2c7e583705c14a9be4b galt Fri Aug 15 12:58:52 2014 -0700 trying to improve error-handling a little by including the stderr output of the background task if it looks like it stopped running. diff --git src/hg/hgTables/genomeSpace.c src/hg/hgTables/genomeSpace.c index 999558e..73f0931 100644 --- src/hg/hgTables/genomeSpace.c +++ src/hg/hgTables/genomeSpace.c @@ -403,31 +403,31 @@ includedResourceFiles = NULL; htmlWarnBoxSetUpAlready=FALSE; htmlOpen("Uploading Output to GenomeSpace"); printf("Name: %s<br>\n", fileName); printf("Size: %s<br>\n", nicenumber); printf("Progress: %0d%%<br>\n", pctUploaded); printf("<br>\n"); printf("<FORM ACTION=\"/cgi-bin/hgTables\" METHOD=GET>\n" "<INPUT TYPE=SUBMIT NAME=\"%s\" VALUE=\"Back\" >" "<INPUT TYPE=SUBMIT NAME=\"Refresh\" VALUE=\"Refresh\" onclick='window.location=window.location;return false;' >" "</FORM>\n" , hgtaDoMainPage); - puts("<script type=\"text/JavaScript\">"); + puts("<script type=\"text/javascript\">"); puts("<!--"); puts("setTimeout(\"location = location;\",5000);"); puts("-->"); puts("</script>"); htmlClose(); fflush(stdout); lastPctUploaded = pctUploaded; } } carefulClose(&f); @@ -470,32 +470,47 @@ htmlClose(); return; } int start; for (start=end; start >= 0 && ! (startsWith("<html>", lines[start]) || startsWith("<HTML>", lines[start])) ; --start) /* do nothing */ ; if (start < 0) { htmlOpen("Background Status"); errAbort("No html start tag found"); htmlClose(); return; } puts("Content-Type: text/html\n"); int line; +boolean autoRefreshFound = FALSE; for (line=start; line <= end; line++) + { puts(lines[line]); + if (startsWith("setTimeout(\"location = location;", lines[line])) + autoRefreshFound = TRUE; + } +// if it looks like the background is no longer running, +// include the .err stdout output for more informative problem message +char urlErr[512]; +char *textErr = NULL; +safef(urlErr, sizeof urlErr, "%s.err", url); +if (!autoRefreshFound && (fileSize(urlErr) > 0)) + { + readInGulp(urlErr, &textErr, NULL); + printf("%s", textErr); + } } #include "trashDir.h" // TODO move this to a generic re-usable location void startBackgroundWork(char *exec, char **pWorkUrl) /* deal with forking off child for background work * and setting up the trash file for communicating * from the child to the browser */ { char *workUrl = NULL; char hgsid[64]; struct tempName tn; safef(hgsid, sizeof(hgsid), "%s", cartSessionId(cart)); trashDirFile(&tn, "backGround", hgsid, ".tmp"); workUrl = cloneString(tn.forCgi);