My previous patch added --exec-sync for Windows. This one also adds it to Unix. Tested on Linux.
The actual patch is quite small since the required infrastructure was already in place. Actually, --exec-sync was already the default for Unix.
Code: Select all
diff --git a/dcmnet/apps/storescp.cc b/dcmnet/apps/storescp.cc
index cf6c40b..39b6e50 100644
--- a/dcmnet/apps/storescp.cc
+++ b/dcmnet/apps/storescp.cc
@@ -191,8 +191,8 @@ OFBool opt_forkMode = OFFalse;
#ifdef _WIN32
OFBool opt_forkedChild = OFFalse;
-OFBool opt_execSync = OFFalse; // default: execute in background
#endif
+OFBool opt_execSync = OFFalse; // default: execute in background
#ifdef WITH_OPENSSL
static int opt_keyFileFormat = SSL_FILETYPE_PEM;
@@ -391,9 +391,7 @@ int main(int argc, char *argv[])
cmd.addOption( "--rename-on-eostudy", "-rns", "(only w/ -ss) Having received and processed\nall C-STORE-Request messages that belong to\none study, rename output files according to\na certain pattern" );
cmd.addOption( "--eostudy-timeout", "-tos", 1, "[t]imeout: integer (only w/ -ss, -xcs or -rns)",
"specifies a timeout of t seconds for\nend-of-study determination" );
-#ifdef _WIN32
cmd.addOption( "--exec-sync", "-xs", "execute command synchronously in foreground" );
-#endif
#ifdef WITH_OPENSSL
cmd.addGroup("transport layer security (TLS) options:");
@@ -806,9 +804,7 @@ int main(int argc, char *argv[])
app.checkValue(cmd.getValueAndCheckMin(opt_endOfStudyTimeout, 0));
}
-#ifdef _WIN32
if (cmd.findOption("--exec-sync")) opt_execSync = OFTrue;
-#endif
}
@@ -2318,7 +2314,7 @@ static void executeCommand( const OFString &cmd )
{
/* we are the parent process */
/* remove pending zombie child processes */
- cleanChildren(pid, OFTrue);
+ cleanChildren(pid, opt_execSync);
}
else // in case we are the child process, execute the command etc.
{
diff --git a/dcmnet/docs/storescp.man b/dcmnet/docs/storescp.man
index 9588ca6..a15f7a4 100644
--- a/dcmnet/docs/storescp.man
+++ b/dcmnet/docs/storescp.man
@@ -270,7 +270,6 @@ filename generation:
-xs --exec-sync
execute command synchronously in foreground.
- This option is available on Windows only.
\endverbatim