6f949e90b1ba3de976455fbcf9da21897761d134
markd
Fri Oct 29 16:11:58 2021 -0700
add timeout option to pipeline to allow kill long-running pipelines, especially ones run from CGIs
diff --git src/hg/hgSession/backup.c src/hg/hgSession/backup.c
index f1daa50..a577ca4 100644
--- src/hg/hgSession/backup.c
+++ src/hg/hgSession/backup.c
@@ -1129,31 +1129,31 @@
char archiveName[1024];
safef(archiveName, sizeof archiveName, "savedSessionCtRaw.tar.gz");
dyStringPrintf(dyProg, "
\n");
int saveDySize = dyProg->stringSize;
dyStringPrintf(dyProg, "creating and compressing archive %s
\n", archiveName);
updateProgessFile(backgroundProgress, dyProg);
lazarusLives(20 * 60);
// create the archive
char *cwd = cloneString(getCurrentDir());
setCurrentDir(tempOutRand);
char excludeBuf[4096];
safef(excludeBuf, sizeof excludeBuf, "--exclude=%s", archiveName);
char *pipeCmd1[] = { "tar", "-zcphf", archiveName, ".", excludeBuf, NULL};
-struct pipeline *pl = pipelineOpen1(pipeCmd1, pipelineWrite | pipelineNoAbort, "/dev/null", NULL);
+struct pipeline *pl = pipelineOpen1(pipeCmd1, pipelineWrite | pipelineNoAbort, "/dev/null", NULL, 0);
int sysVal = pipelineWait(pl);
setCurrentDir(cwd);
if (!((sysVal == 0) || (sysVal == 1))) // we tolerate 1 because tar doesn't like us creating the archive in the directory we're backing up
errAbort("System call returned %d for:\n %s", sysVal, pipelineDesc(pl));
dyProg->stringSize = saveDySize; // restore prev size, popping.
dyProg->string[dyProg->stringSize] = 0;
dyStringPrintf(dyProg, "archive %s created
\n", archiveName);
updateProgessFile(backgroundProgress, dyProg);
lazarusLives(20 * 60);
char downPath[1024];
safef(downPath, sizeof downPath, "%s/%s", tempOutRand, archiveName);