*/
uint16_t type;
+ /**
+ * Flags for passing std descriptors to ARM (when starting ARM).
+ */
+ enum GNUNET_OS_InheritStdioFlags std_inheritance;
+
};
#include "do_start_process.c"
{
/* Means we are ONLY running locally */
/* we're clearly running a test, don't daemonize */
- proc = do_start_process (GNUNET_NO,
+ proc = do_start_process (GNUNET_NO, pos->std_inheritance,
NULL, loprefix, binary, "-c", config,
/* no daemonization! */
lopostfix, NULL);
}
else
{
- proc = do_start_process (GNUNET_NO,
+ proc = do_start_process (GNUNET_NO, pos->std_inheritance,
NULL, loprefix, binary, "-c", config,
"-d", lopostfix, NULL);
}
*
* @param h handle to ARM
* @param service_name name of the service
+ * @param std_inheritance inheritance of std streams
* @param timeout how long to wait before failing for good
* @param cb callback to invoke when service is ready
* @param cb_cls closure for callback
void
GNUNET_ARM_start_service (struct GNUNET_ARM_Handle *h,
const char *service_name,
+ enum GNUNET_OS_InheritStdioFlags std_inheritance,
struct GNUNET_TIME_Relative timeout,
GNUNET_ARM_Callback cb, void *cb_cls)
{
sctx->callback = cb;
sctx->cls = cb_cls;
sctx->timeout = GNUNET_TIME_relative_to_absolute (timeout);
+ sctx->std_inheritance = std_inheritance;
memcpy (&sctx[1], service_name, slen);
GNUNET_CLIENT_service_test ("arm", h->cfg, timeout, &arm_service_report,
sctx);
return;
}
- if (h->client == NULL)
+ if (NULL == h->client)
{
client = GNUNET_CLIENT_connect ("arm", h->cfg);
if (client == NULL)
* with spaces to the new process.
*
* @param pipe_control should a pipe be used to send signals to the child?
+ * @param std_inheritance a set of GNUNET_OS_INHERIT_STD_* flags
* @param lsocks array of listen sockets to dup starting at fd3 (systemd-style), or NULL
* @param first_arg first argument for argv (may be an empty string)
* @param ... more arguments, NULL terminated
* @return handle of the started process, NULL on error
*/
static struct GNUNET_OS_Process *
-do_start_process (int pipe_control,
+do_start_process (int pipe_control, unsigned int std_inheritance,
const SOCKTYPE * lsocks, const char *first_arg, ...)
{
va_list ap;
/* *INDENT-ON* */
va_end (ap);
argv[argv_size] = NULL;
- proc = GNUNET_OS_start_process_v (pipe_control, lsocks, argv[0], argv);
+ proc = GNUNET_OS_start_process_v (pipe_control, std_inheritance, lsocks, argv[0], argv);
while (argv_size > 0)
GNUNET_free (argv[--argv_size]);
GNUNET_free (argv);
static struct GNUNET_TIME_Relative timeout;
+/**
+ * Do we want to give our stdout to gnunet-service-arm?
+ */
+static unsigned int no_stdout = 0;
+
+/**
+ * Do we want to give our stderr to gnunet-service-arm?
+ */
+static unsigned int no_stderr = 0;
+
/**
* Main continuation-passing-style loop. Runs the various
* jobs that we've been asked to do in order.
if (start)
{
GNUNET_ARM_start_service (h, "arm",
+ (no_stdout ? 0 : GNUNET_OS_INHERIT_STD_OUT) |
+ (no_stderr ? 0 : GNUNET_OS_INHERIT_STD_ERR),
(0 ==
timeout.rel_value) ? START_TIMEOUT :
timeout, &confirm_cb, "arm");
if (init != NULL)
{
GNUNET_ARM_start_service (h, init,
+ (no_stdout ? 0 : GNUNET_OS_INHERIT_STD_OUT) |
+ (no_stderr ? 0 : GNUNET_OS_INHERIT_STD_ERR),
(0 ==
timeout.rel_value) ? START_TIMEOUT :
timeout, &confirm_cb, init);
GNUNET_YES, &GNUNET_GETOPT_set_ulong, &temp_timeout_ms},
{'I', "info", NULL, gettext_noop ("List currently running services"),
GNUNET_NO, &GNUNET_GETOPT_set_one, &list},
+ {'O', "no-stdout", NULL, gettext_noop ("Don't let gnunet-service-arm inherit standard output"),
+ GNUNET_NO, &GNUNET_GETOPT_set_one, &no_stdout},
+ {'E', "no-stderr", NULL, gettext_noop ("Don't let gnunet-service-arm inherit standard error"),
+ GNUNET_NO, &GNUNET_GETOPT_set_one, &no_stderr},
GNUNET_GETOPT_OPTION_END
};
GNUNET_assert (NULL == sl->proc);
if (GNUNET_YES == use_debug)
sl->proc =
- do_start_process (sl->pipe_control,
+ do_start_process (sl->pipe_control, GNUNET_OS_INHERIT_STD_OUT_AND_ERR,
lsocks, loprefix, sl->binary, "-c", sl->config, "-L",
"DEBUG", options, NULL);
else
sl->proc =
- do_start_process (sl->pipe_control,
+ do_start_process (sl->pipe_control, GNUNET_OS_INHERIT_STD_OUT_AND_ERR,
lsocks, loprefix, sl->binary, "-c", sl->config,
options, NULL);
if (sl->proc == NULL)
GNUNET_ARM_stop_service (arm, "arm", TIMEOUT, &arm_stopped, NULL);
#endif
}
- GNUNET_ARM_start_service (arm, "resolver", START_TIMEOUT, &resolver_notify,
+ GNUNET_ARM_start_service (arm, "resolver", GNUNET_OS_INHERIT_STD_OUT_AND_ERR, START_TIMEOUT, &resolver_notify,
NULL);
}
cfg = c;
arm = GNUNET_ARM_connect (cfg, NULL);
#if START_ARM
- GNUNET_ARM_start_service (arm, "arm", START_TIMEOUT, &arm_notify, NULL);
+ GNUNET_ARM_start_service (arm, "arm", GNUNET_OS_INHERIT_STD_OUT_AND_ERR, START_TIMEOUT, &arm_notify, NULL);
#else
arm_notify (NULL, GNUNET_YES);
#endif
arm_notify (void *cls, enum GNUNET_ARM_ProcessStatus status)
{
GNUNET_assert (status == GNUNET_ARM_PROCESS_STARTING);
- GNUNET_ARM_start_service (arm, "do-nothing", TIMEOUT, &do_nothing_notify,
+ GNUNET_ARM_start_service (arm, "do-nothing", GNUNET_OS_INHERIT_STD_OUT_AND_ERR, TIMEOUT, &do_nothing_notify,
NULL);
}
arm = GNUNET_ARM_connect (cfg, NULL);
#if START_ARM
- GNUNET_ARM_start_service (arm, "arm", GNUNET_TIME_UNIT_ZERO, &arm_notify,
+ GNUNET_ARM_start_service (arm, "arm", GNUNET_OS_INHERIT_STD_OUT_AND_ERR, GNUNET_TIME_UNIT_ZERO, &arm_notify,
NULL);
#else
arm_do_nothing (NULL, GNUNET_YES);
cfg = c;
#if START_ARM
arm = GNUNET_ARM_connect (cfg, NULL);
- GNUNET_ARM_start_service (arm, "arm", START_TIMEOUT, &arm_notify, NULL);
+ GNUNET_ARM_start_service (arm, "arm", GNUNET_OS_INHERIT_STD_OUT_AND_ERR, START_TIMEOUT, &arm_notify, NULL);
#else
arm_notify (NULL, GNUNET_YES);
#endif
p->cfg = GNUNET_CONFIGURATION_create ();
#if START_ARM
p->arm_proc =
- GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-service-arm",
+ GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, "gnunet-service-arm",
"gnunet-service-arm",
#if VERBOSE
"-L", "DEBUG",
p->cfg = GNUNET_CONFIGURATION_create ();
#if START_ARM
p->arm_proc =
- GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-service-arm",
+ GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, "gnunet-service-arm",
"gnunet-service-arm",
#if VERBOSE
"-L", "DEBUG",
p->cfg = GNUNET_CONFIGURATION_create ();
#if START_ARM
p->arm_proc =
- GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-service-arm",
+ GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, "gnunet-service-arm",
"gnunet-service-arm",
#if VERBOSE
"-L", "DEBUG",
p->cfg = GNUNET_CONFIGURATION_create ();
#if START_ARM
p->arm_proc =
- GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-service-arm",
+ GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, "gnunet-service-arm",
"gnunet-service-arm",
"-c", cfgname, NULL);
#endif
{
p->cfg = GNUNET_CONFIGURATION_create ();
p->arm_proc =
- GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-service-arm",
+ GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, "gnunet-service-arm",
"gnunet-service-arm",
"-c", cfgname, NULL);
GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (p->cfg, cfgname));
p->cfg = GNUNET_CONFIGURATION_create ();
#if START_ARM
p->arm_proc =
- GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-service-arm",
+ GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, "gnunet-service-arm",
"gnunet-service-arm",
"-c", cfgname, NULL);
#endif
_("Publishing `%s'\n"),
wi->filename);
publish_proc = GNUNET_OS_start_process_vap (GNUNET_YES,
- NULL, NULL,
+ 0, NULL, NULL,
"gnunet-publish",
argv);
if (NULL == publish_proc)
{
p->cfg = GNUNET_CONFIGURATION_create ();
p->arm_proc =
- GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-service-arm",
+ GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, "gnunet-service-arm",
"gnunet-service-arm",
"-c", cfgname, NULL);
GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (p->cfg, cfgname));
p->cfg = GNUNET_CONFIGURATION_create ();
p->arm_proc =
- GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-service-arm",
+ GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, "gnunet-service-arm",
"gnunet-service-arm",
"-c", cfgname, NULL);
GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (p->cfg, cfgname));
{
p->cfg = GNUNET_CONFIGURATION_create ();
p->arm_proc =
- GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-service-arm",
+ GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, "gnunet-service-arm",
"gnunet-service-arm",
"-c", cfgname, NULL);
GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (p->cfg, cfgname));
p->cfg = GNUNET_CONFIGURATION_create ();
#if START_ARM
p->arm_proc =
- GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-service-arm",
+ GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, "gnunet-service-arm",
"gnunet-service-arm",
#if VERBOSE
"-L", "DEBUG",
#include "gnunet_configuration_lib.h"
#include "gnunet_scheduler_lib.h"
+#include "gnunet_os_lib.h"
#include "gnunet_time_lib.h"
/**
*
* @param h handle to ARM
* @param service_name name of the service
+ * @param std_inheritance flags controlling std descriptors inheritance
* @param timeout how long to wait before failing for good
* @param cb callback to invoke when service is ready
* @param cb_cls closure for callback
*/
void
GNUNET_ARM_start_service (struct GNUNET_ARM_Handle *h, const char *service_name,
+ enum GNUNET_OS_InheritStdioFlags std_inheritance,
struct GNUNET_TIME_Relative timeout,
GNUNET_ARM_Callback cb, void *cb_cls);
#include "gnunet_configuration_lib.h"
#include "gnunet_scheduler_lib.h"
+
+/**
+ * Flags that determine which of the standard streams
+ * should be inherited by the child process.
+ */
+enum GNUNET_OS_InheritStdioFlags
+{
+
+ /**
+ * No standard streams should be inherited.
+ */
+ GNUNET_OS_INHERIT_STD_NONE = 0,
+
+ /**
+ * When this flag is set, the child process will
+ * inherit stdin of the parent.
+ */
+ GNUNET_OS_INHERIT_STD_IN = 1,
+
+ /**
+ * When this flag is set, the child process will
+ * inherit stdout of the parent.
+ */
+ GNUNET_OS_INHERIT_STD_OUT = 2,
+
+ /**
+ * When this flag is set, the child process will
+ * inherit stderr of the parent.
+ */
+ GNUNET_OS_INHERIT_STD_ERR = 4,
+
+ /**
+ * When these flags are set, the child process will
+ * inherit stdout and stderr of the parent.
+ */
+ GNUNET_OS_INHERIT_STD_OUT_AND_ERR = 6,
+
+ /**
+ * Use this option to have all of the standard streams
+ * (stdin, stdout and stderror) be inherited.
+ */
+ GNUNET_OS_INHERIT_STD_ALL = 7
+};
+
+
/**
* Process information (OS-dependent)
*/
* Start a process.
*
* @param pipe_control should a pipe be used to send signals to the child?
+ * @param std_inheritance a set of GNUNET_OS_INHERIT_STD_* flags
* @param pipe_stdin pipe to use to send input to child process (or NULL)
* @param pipe_stdout pipe to use to get output from child process (or NULL)
* @param filename name of the binary
*/
struct GNUNET_OS_Process *
GNUNET_OS_start_process_vap (int pipe_control,
+ enum GNUNET_OS_InheritStdioFlags std_inheritance,
struct GNUNET_DISK_PipeHandle *pipe_stdin,
struct GNUNET_DISK_PipeHandle *pipe_stdout,
const char *filename,
* Start a process.
*
* @param pipe_control should a pipe be used to send signals to the child?
+ * @param std_inheritance a set of GNUNET_OS_INHERIT_STD_* flags
* @param pipe_stdin pipe to use to send input to child process (or NULL)
* @param pipe_stdout pipe to use to get output from child process (or NULL)
* @param filename name of the binary
*/
struct GNUNET_OS_Process *
GNUNET_OS_start_process (int pipe_control,
+ enum GNUNET_OS_InheritStdioFlags std_inheritance,
struct GNUNET_DISK_PipeHandle *pipe_stdin,
struct GNUNET_DISK_PipeHandle *pipe_stdout,
const char *filename, ...);
* Start a process.
*
* @param pipe_control should a pipe be used to send signals to the child?
+ * @param std_inheritance a set of GNUNET_OS_INHERIT_STD_* flags
* @param pipe_stdin pipe to use to send input to child process (or NULL)
* @param pipe_stdout pipe to use to get output from child process (or NULL)
* @param filename name of the binary
*/
struct GNUNET_OS_Process *
GNUNET_OS_start_process_va (int pipe_control,
+ enum GNUNET_OS_InheritStdioFlags std_inheritance,
struct GNUNET_DISK_PipeHandle *pipe_stdin,
struct GNUNET_DISK_PipeHandle *pipe_stdout,
const char *filename, va_list va);
* Start a process.
*
* @param pipe_control should a pipe be used to send signals to the child?
+ * @param std_inheritance a set of GNUNET_OS_INHERIT_STD_* flags
* @param lsocks array of listen sockets to dup systemd-style (or NULL);
* must be NULL on platforms where dup is not supported
* @param filename name of the binary
*/
struct GNUNET_OS_Process *
GNUNET_OS_start_process_v (int pipe_control,
+ enum GNUNET_OS_InheritStdioFlags std_inheritance,
const SOCKTYPE *lsocks,
const char *filename,
char *const argv[]);
"gnunet-helper-nat-server", h->internal_address);
/* Start the server process */
h->server_proc =
- GNUNET_OS_start_process (GNUNET_NO, NULL, h->server_stdout,
+ GNUNET_OS_start_process (GNUNET_NO, 0, NULL, h->server_stdout,
"gnunet-helper-nat-server",
"gnunet-helper-nat-server",
h->internal_address, NULL);
_("Running gnunet-helper-nat-client %s %s %u\n"), h->internal_address,
inet4, (unsigned int) h->adv_port);
proc =
- GNUNET_OS_start_process (GNUNET_NO,
- NULL, NULL, "gnunet-helper-nat-client",
+ GNUNET_OS_start_process (GNUNET_NO, 0, NULL, NULL,
+ "gnunet-helper-nat-client",
"gnunet-helper-nat-client", h->internal_address,
inet4, port_as_string, NULL);
if (NULL == proc)
return NULL;
}
eh->eip =
- GNUNET_OS_start_process (GNUNET_NO, NULL, eh->opipe, "external-ip", "external-ip",
+ GNUNET_OS_start_process (GNUNET_NO, 0, NULL, eh->opipe, "external-ip", "external-ip",
NULL);
if (NULL == eh->eip)
{
}
gns =
- GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-nat-server",
+ GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, "gnunet-nat-server",
"gnunet-nat-server",
"-c", "test_nat_test_data.conf", "12345", NULL);
GNUNET_assert (NULL != gns);
struct GNUNET_OS_Process *proc;
proc =
- GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-service-statistics",
+ GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, "gnunet-service-statistics",
"gnunet-service-statistics",
"-c", "test_statistics_api_data.conf", NULL);
#endif
#if START_SERVICE
/* restart to check persistence! */
proc =
- GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-service-statistics",
+ GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, "gnunet-service-statistics",
"gnunet-service-statistics",
"-c", "test_statistics_api_data.conf", NULL);
#endif
struct GNUNET_OS_Process *proc;
proc =
- GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-service-statistics",
+ GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, "gnunet-service-statistics",
"gnunet-service-statistics",
#if DEBUG_STATISTICS
"-L", "DEBUG",
struct GNUNET_OS_Process *proc;
proc =
- GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-service-statistics",
+ GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, "gnunet-service-statistics",
"gnunet-service-statistics",
#if VERBOSE
"-L", "DEBUG",
struct GNUNET_OS_Process *proc;
proc =
- GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-service-statistics",
+ GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, "gnunet-service-statistics",
"gnunet-service-statistics",
#if VERBOSE
"-L", "DEBUG",
if ((NULL == host) || (0 == host->id))
{
h->process = GNUNET_OS_start_process_vap (GNUNET_YES,
+ GNUNET_OS_INHERIT_STD_OUT |
+ GNUNET_OS_INHERIT_STD_ERR,
h->cpipe, NULL,
"gnunet-service-testbed",
binary_argv);
remote_args[argp++] = NULL;
GNUNET_assert (argp == argc + 6 + 1);
h->process = GNUNET_OS_start_process_vap (GNUNET_YES,
+ GNUNET_OS_INHERIT_STD_OUT |
+ GNUNET_OS_INHERIT_STD_ERR,
h->cpipe, NULL,
"ssh",
remote_args);
return GNUNET_SYSERR;
}
GNUNET_assert (NULL != peer->cfgfile);
- peer->main_process = GNUNET_OS_start_process (GNUNET_YES, NULL, NULL,
+ peer->main_process = GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL,
peer->main_binary,
peer->main_binary,
"-c",
GNUNET_asprintf (&peer_number, "%llu", num_peers);
GNUNET_asprintf (&connect_number, "%llu", expected_connections);
mem_process =
- GNUNET_OS_start_process (NULL, NULL, "./memsize.pl", "memsize.pl",
+ GNUNET_OS_start_process (NULL, NULL, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, "./memsize.pl", "memsize.pl",
"totals.txt", peer_number, connect_number, NULL);
GNUNET_OS_process_wait (mem_process);
GNUNET_OS_process_destroy (mem_process);
GNUNET_asprintf (&peer_number, "%llu", num_peers);
GNUNET_asprintf (&connect_number, "%llu", expected_connections);
mem_process =
- GNUNET_OS_start_process (NULL, NULL, "./memsize.pl", "memsize.pl",
+ GNUNET_OS_start_process (NULL, NULL, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, "./memsize.pl", "memsize.pl",
"totals.txt", peer_number, connect_number, NULL);
GNUNET_OS_process_wait (mem_process);
GNUNET_OS_process_destroy (mem_process);
"gnunet-peerinfo", "gnunet-peerinfo", "-c", d->cfgfile,
"-sq");
d->proc_arm_peerinfo =
- GNUNET_OS_start_process (GNUNET_YES, NULL, d->pipe_stdout, "gnunet-peerinfo",
+ GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, d->pipe_stdout, "gnunet-peerinfo",
"gnunet-peerinfo", "-c", d->cfgfile, "-sq",
NULL);
GNUNET_DISK_pipe_close_end (d->pipe_stdout, GNUNET_DISK_PIPE_END_WRITE);
d->cfgfile, "-sq");
if (d->ssh_port_str == NULL)
{
- d->proc_arm_peerinfo = GNUNET_OS_start_process (GNUNET_NO, NULL, d->pipe_stdout, "ssh", "ssh",
+ d->proc_arm_peerinfo = GNUNET_OS_start_process (GNUNET_NO, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, d->pipe_stdout, "ssh", "ssh",
"-q",
dst, "gnunet-peerinfo", "-c",
d->cfgfile, "-sq", NULL);
else
{
d->proc_arm_peerinfo =
- GNUNET_OS_start_process (GNUNET_NO, NULL, d->pipe_stdout, "ssh", "ssh", "-p",
+ GNUNET_OS_start_process (GNUNET_NO, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, d->pipe_stdout, "ssh", "ssh", "-p",
d->ssh_port_str,
"-q",
dst, "gnunet-peerinfo", "-c", d->cfgfile,
"gnunet-arm", "gnunet-arm", "-c", d->cfgfile,
"-s");
d->proc_arm_start =
- GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-arm", "gnunet-arm", "-c",
+ GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, "gnunet-arm", "gnunet-arm", "-c",
d->cfgfile,
"-s", "-q", "-T",
GNUNET_TIME_relative_to_string
"-s", "-q");
if (d->ssh_port_str == NULL)
{
- d->proc_arm_start = GNUNET_OS_start_process (GNUNET_NO, NULL, NULL, "ssh", "ssh",
+ d->proc_arm_start = GNUNET_OS_start_process (GNUNET_NO, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, "ssh", "ssh",
"-q",
dst, "gnunet-arm",
"-c", d->cfgfile, "-s", "-q", "-T",
{
d->proc_arm_start =
- GNUNET_OS_start_process (GNUNET_NO, NULL, NULL, "ssh", "ssh", "-p",
+ GNUNET_OS_start_process (GNUNET_NO, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, "ssh", "ssh", "-p",
d->ssh_port_str,
"-q",
dst, "gnunet-arm",
else
arg = GNUNET_strdup (d->hostname);
- d->proc_arm_srv_start = GNUNET_OS_start_process (GNUNET_NO, NULL, NULL, "ssh", "ssh",
+ d->proc_arm_srv_start = GNUNET_OS_start_process (GNUNET_NO, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, "ssh", "ssh",
"-q",
arg, "gnunet-arm",
"-c", d->cfgfile, "-i", service, "-q",
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Starting gnunet-arm with config `%s' locally.\n", d->cfgfile);
- d->proc_arm_srv_start = GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-arm", "gnunet-arm",
+ d->proc_arm_srv_start = GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, "gnunet-arm", "gnunet-arm",
"-c", d->cfgfile, "-i", service, "-q",
"-T",
GNUNET_TIME_relative_to_string (timeout),
else
arg = GNUNET_strdup (d->hostname);
- d->proc_arm_srv_start = GNUNET_OS_start_process (GNUNET_NO, NULL, NULL, "ssh", "ssh",
+ d->proc_arm_srv_start = GNUNET_OS_start_process (GNUNET_NO, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, "ssh", "ssh",
"-q",
arg, "gnunet-arm",
"-c", d->cfgfile, "-i", service, "-q",
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Starting gnunet-arm with config `%s' locally.\n", d->cfgfile);
- d->proc_arm_srv_start = GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-arm", "gnunet-arm",
+ d->proc_arm_srv_start = GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, "gnunet-arm", "gnunet-arm",
"-c", d->cfgfile, "-i", service, "-q",
"-T",
GNUNET_TIME_relative_to_string (timeout),
GNUNET_free (baseservicehome);
if (ret->ssh_port_str == NULL)
{
- ret->proc_arm_copying = GNUNET_OS_start_process (GNUNET_NO, NULL, NULL, "scp", "scp", "-r",
+ ret->proc_arm_copying = GNUNET_OS_start_process (GNUNET_NO, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, "scp", "scp", "-r",
"-q",
servicehome, arg, NULL);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
else
{
ret->proc_arm_copying =
- GNUNET_OS_start_process (GNUNET_NO, NULL, NULL, "scp", "scp", "-r", "-P",
+ GNUNET_OS_start_process (GNUNET_NO, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, "scp", "scp", "-r", "-P",
ret->ssh_port_str,
"-q",
servicehome, arg, NULL);
else
arg = GNUNET_strdup (d->hostname);
- d->proc_arm_stop = GNUNET_OS_start_process (GNUNET_NO, NULL, NULL, "ssh", "ssh",
+ d->proc_arm_stop = GNUNET_OS_start_process (GNUNET_NO, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, "ssh", "ssh",
"-q",
arg, "gnunet-arm",
"-c", d->cfgfile, "-e", "-r", NULL);
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Stopping gnunet-arm with config `%s' locally.\n", d->cfgfile);
- d->proc_arm_stop = GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-arm", "gnunet-arm",
+ d->proc_arm_stop = GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, "gnunet-arm", "gnunet-arm",
"-c", d->cfgfile, "-e", "-r", NULL);
}
else
arg = GNUNET_strdup (d->hostname);
- d->proc_arm_srv_stop = GNUNET_OS_start_process (GNUNET_NO, NULL, NULL, "ssh", "ssh",
+ d->proc_arm_srv_stop = GNUNET_OS_start_process (GNUNET_NO, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, "ssh", "ssh",
"-q",
arg, "gnunet-arm",
"-c", d->cfgfile, "-k", service, "-q",
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Stopping gnunet-arm with config `%s' locally.\n", d->cfgfile);
- d->proc_arm_srv_stop = GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-arm", "gnunet-arm",
+ d->proc_arm_srv_stop = GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, "gnunet-arm", "gnunet-arm",
"-c", d->cfgfile, "-k", service, "-q",
"-T",
GNUNET_TIME_relative_to_string (timeout),
else
arg = GNUNET_strdup (d->hostname);
- d->proc_arm_stop = GNUNET_OS_start_process (GNUNET_NO, NULL, NULL, "ssh", "ssh",
+ d->proc_arm_stop = GNUNET_OS_start_process (GNUNET_NO, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, "ssh", "ssh",
"-q",
arg, "gnunet-arm",
"-c", d->cfgfile, "-e", "-q", "-T",
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Stopping gnunet-arm with config `%s' locally.\n", d->cfgfile);
- d->proc_arm_stop = GNUNET_OS_start_process (GNUNET_NO, NULL, NULL, "gnunet-arm", "gnunet-arm",
+ d->proc_arm_stop = GNUNET_OS_start_process (GNUNET_NO, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, "gnunet-arm", "gnunet-arm",
"-c", d->cfgfile, "-e", "-q", "-T",
GNUNET_TIME_relative_to_string (timeout),
del_arg, NULL);
GNUNET_asprintf (&arg, "%s@%s:%s", d->username, d->hostname, d->cfgfile);
else
GNUNET_asprintf (&arg, "%s:%s", d->hostname, d->cfgfile);
- d->proc_arm_copying = GNUNET_OS_start_process (GNUNET_NO, NULL, NULL, "scp", "scp",
+ d->proc_arm_copying = GNUNET_OS_start_process (GNUNET_NO, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, "scp", "scp",
"-q",
d->cfgfile, arg, NULL);
GNUNET_free (arg);
pg->peers[pg_iter].daemon->hostname,
temp_service_path);
procarr[pg_iter] =
- GNUNET_OS_start_process (GNUNET_NO, NULL, NULL, "scp", "scp", mytemp, arg, NULL);
+ GNUNET_OS_start_process (GNUNET_NO, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, "scp", "scp", mytemp, arg, NULL);
GNUNET_assert (procarr[pg_iter] != NULL);
ret = GNUNET_OS_process_wait (procarr[pg_iter]); /* FIXME: schedule this, throttle! */
GNUNET_OS_process_destroy (procarr[pg_iter]);
pg->peers[pg_iter].daemon->hostname,
temp_service_path);
procarr[pg_iter] =
- GNUNET_OS_start_process (GNUNET_NO, NULL, NULL, "scp", "scp", mytemp, arg, NULL);
+ GNUNET_OS_start_process (GNUNET_NO, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, "scp", "scp", mytemp, arg, NULL);
GNUNET_assert (procarr[pg_iter] != NULL);
GNUNET_OS_process_wait (procarr[pg_iter]); /* FIXME: add scheduled blacklist file copy that parallelizes file copying! */
/* FIXME: Doesn't support ssh_port option! */
helper->proc =
- GNUNET_OS_start_process (GNUNET_NO, NULL, NULL, "ssh", "ssh", arg,
+ GNUNET_OS_start_process (GNUNET_NO, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, "ssh", "ssh", arg,
"peerStartHelper.pl", tempdir, NULL);
GNUNET_assert (helper->proc != NULL);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "starting peers with cmd ssh %s %s %s\n",
{
GNUNET_asprintf (&ssh_port_str, "%d", pg->hosts[i].sshport);
proc =
- GNUNET_OS_start_process (GNUNET_NO, NULL, NULL, "ssh", "ssh", "-P", ssh_port_str,
+ GNUNET_OS_start_process (GNUNET_NO, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, "ssh", "ssh", "-P", ssh_port_str,
"-q",
arg, "mkdir -p", tmpdir, NULL);
}
else
proc =
- GNUNET_OS_start_process (GNUNET_NO, NULL, NULL, "ssh", "ssh", arg, "mkdir -p",
+ GNUNET_OS_start_process (GNUNET_NO, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, "ssh", "ssh", arg, "mkdir -p",
tmpdir, NULL);
GNUNET_assert (proc != NULL);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
/* FIXME: Doesn't support ssh_port option! */
proc =
- GNUNET_OS_start_process (GNUNET_NO, NULL, NULL, "rsync", "rsync", "-r",
+ GNUNET_OS_start_process (GNUNET_NO, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, "rsync", "rsync", "-r",
newservicehome, arg, NULL);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"copying directory with command rsync -r %s %s\n",
/* Create RSA Private Key */
/* openssl genrsa -out $1 1024 2> /dev/null */
openssl =
- GNUNET_OS_start_process (GNUNET_NO, NULL, NULL, "openssl", "openssl", "genrsa",
+ GNUNET_OS_start_process (GNUNET_NO, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, "openssl", "openssl", "genrsa",
"-out", argv[1], "1024", NULL);
if (openssl == NULL)
return 2;
/* Create a self-signed certificate in batch mode using rsa key */
/* openssl req -batch -days 365 -out $2 -new -x509 -key $1 2> /dev/null */
openssl =
- GNUNET_OS_start_process (GNUNET_NO, NULL, NULL, "openssl", "openssl", "req",
+ GNUNET_OS_start_process (GNUNET_NO, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, "openssl", "openssl", "req",
"-batch", "-days", "365", "-out", argv[2],
"-new", "-x509", "-key", argv[1], NULL);
if (openssl == NULL)
adv_port = bnd_port;
if (NULL == resolver)
resolver =
- GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-service-resolver",
+ GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, "gnunet-service-resolver",
"gnunet-service-resolver", NULL);
resolver_users++;
GNUNET_RESOLVER_connect (cfg);
"No usable TLS certificate found, creating certificate\n");
errno = 0;
cert_creation =
- GNUNET_OS_start_process (GNUNET_NO, NULL, NULL,
+ GNUNET_OS_start_process (GNUNET_NO, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL,
"gnunet-transport-certificate-creation",
"gnunet-transport-certificate-creation",
key_file, cert_file, NULL);
LOG (GNUNET_ERROR_TYPE_INFO, _("Starting `%s' process to generate entropy\n"),
"find");
genproc =
- GNUNET_OS_start_process (GNUNET_NO,
+ GNUNET_OS_start_process (GNUNET_NO, 0,
NULL, NULL, "sh", "sh", "-c",
"exec find / -mount -type f -exec cp {} /dev/null \\; 2>/dev/null",
NULL);
GNUNET_DISK_pipe_handle (sigpipe,
GNUNET_DISK_PIPE_END_READ),
&maint_child_death, NULL);
- p = GNUNET_OS_start_process (GNUNET_NO,
+ p = GNUNET_OS_start_process (GNUNET_NO, 0,
NULL, NULL,
program,
program,
h->fh_to_helper =
GNUNET_DISK_pipe_handle (h->helper_in, GNUNET_DISK_PIPE_END_WRITE);
h->helper_proc =
- GNUNET_OS_start_process_vap (GNUNET_NO,
+ GNUNET_OS_start_process_vap (GNUNET_NO, 0,
h->helper_in, h->helper_out,
h->binary_name,
h->binary_argv);
* Start a process.
*
* @param pipe_control should a pipe be used to send signals to the child?
+ * @param std_inheritance a set of GNUNET_OS_INHERIT_STD_* flags controlling which
+ * std handles of the parent are inherited by the child.
+ * pipe_stdin and pipe_stdout take priority over std_inheritance
+ * (when they are non-NULL).
* @param pipe_stdin pipe to use to send input to child process (or NULL)
* @param pipe_stdout pipe to use to get output from child process (or NULL)
* @param lsocks array of listen sockets to dup systemd-style (or NULL);
*/
static struct GNUNET_OS_Process *
start_process (int pipe_control,
+ enum GNUNET_OS_InheritStdioFlags std_inheritance,
struct GNUNET_DISK_PipeHandle *pipe_stdin,
struct GNUNET_DISK_PipeHandle *pipe_stdout,
const SOCKTYPE *lsocks,
LOG_STRERROR (GNUNET_ERROR_TYPE_ERROR, "dup2");
GNUNET_break (0 == close (fd_stdout_write));
}
+ else if (!(std_inheritance & GNUNET_OS_INHERIT_STD_OUT))
+ {
+ close (1);
+ }
if (pipe_stdin != NULL)
{
LOG_STRERROR (GNUNET_ERROR_TYPE_ERROR, "dup2");
GNUNET_break (0 == close (fd_stdin_read));
}
+ else if (!(std_inheritance & GNUNET_OS_INHERIT_STD_IN))
+ {
+ close (0);
+ }
+ if (!(std_inheritance & GNUNET_OS_INHERIT_STD_ERR))
+ {
+ close (2);
+ }
if (lscp != NULL)
{
/* read systemd documentation... */
long lRet;
HANDLE stdin_handle;
HANDLE stdout_handle;
+ HANDLE stdih, stdoh, stdeh;
+ DWORD stdif, stdof, stdef;
+ BOOL bresult;
+ DWORD error_code;
if (GNUNET_SYSERR == GNUNET_OS_check_helper_binary (filename))
return NULL; /* not executable */
memset (&start, 0, sizeof (start));
start.cb = sizeof (start);
- if ((pipe_stdin != NULL) || (pipe_stdout != NULL))
+ if ((pipe_stdin != NULL) || (pipe_stdout != NULL) || (std_inheritance != 0))
start.dwFlags |= STARTF_USESTDHANDLES;
+ stdih = GetStdHandle (STD_INPUT_HANDLE);
+ GetHandleInformation (stdih, &stdif);
if (pipe_stdin != NULL)
{
GNUNET_DISK_internal_file_handle_ (GNUNET_DISK_pipe_handle
&stdin_handle, sizeof (HANDLE));
start.hStdInput = stdin_handle;
}
+ if (stdih)
+ {
+ if (std_inheritance & GNUNET_OS_INHERIT_STD_IN)
+ {
+ SetHandleInformation (stdih, HANDLE_FLAG_INHERIT, 1);
+ if (pipe_stdin == NULL)
+ start.hStdInput = stdih;
+ }
+ else
+ SetHandleInformation (stdih, HANDLE_FLAG_INHERIT, 0);
+ }
+
+ stdoh = GetStdHandle (STD_OUTPUT_HANDLE);
+ GetHandleInformation (stdoh, &stdof);
if (pipe_stdout != NULL)
{
GNUNET_DISK_internal_file_handle_ (GNUNET_DISK_pipe_handle
&stdout_handle, sizeof (HANDLE));
start.hStdOutput = stdout_handle;
}
+ if (stdoh)
+ {
+ if (std_inheritance & GNUNET_OS_INHERIT_STD_OUT)
+ {
+ SetHandleInformation (stdoh, HANDLE_FLAG_INHERIT, 1);
+ if (pipe_stdout == NULL)
+ start.hStdOutput = stdoh;
+ }
+ else
+ SetHandleInformation (stdoh, HANDLE_FLAG_INHERIT, 0);
+ }
+
+ stdeh = GetStdHandle (STD_ERROR_HANDLE);
+ GetHandleInformation (stdeh, &stdef);
+ if (stdeh)
+ {
+ if (std_inheritance & GNUNET_OS_INHERIT_STD_ERR)
+ {
+ SetHandleInformation (stdeh, HANDLE_FLAG_INHERIT, 1);
+ start.hStdError = stdeh;
+ }
+ else
+ SetHandleInformation (stdeh, HANDLE_FLAG_INHERIT, 0);
+ }
if (GNUNET_YES == pipe_control)
{
return NULL;
}
- if (!CreateProcessW (wpath, wcmd, NULL, NULL, TRUE,
- DETACHED_PROCESS | CREATE_SUSPENDED, env_block, NULL, &start, &proc))
+ bresult = CreateProcessW (wpath, wcmd, NULL, NULL, TRUE,
+ DETACHED_PROCESS | CREATE_SUSPENDED, env_block, NULL, &start, &proc);
+ error_code = GetLastError ();
+
+ if ((NULL == pipe_stdin) && (stdih))
+ SetHandleInformation (stdih, HANDLE_FLAG_INHERIT, stdif);
+
+
+ if ((NULL == pipe_stdout) && (stdoh))
+ SetHandleInformation (stdoh, HANDLE_FLAG_INHERIT, stdof);
+
+ if (stdeh)
+ SetHandleInformation (stdeh, HANDLE_FLAG_INHERIT, stdef);
+
+ GNUNET_free (env_block);
+ GNUNET_free (cmd);
+ free (wpath);
+ free (wcmd);
+
+ if (!bresult)
{
- SetErrnoFromWinError (GetLastError ());
+ SetErrnoFromWinError (error_code);
LOG_STRERROR (GNUNET_ERROR_TYPE_ERROR, "CreateProcess");
if (NULL != control_pipe)
GNUNET_DISK_file_close (control_pipe);
if (NULL != lsocks)
GNUNET_DISK_pipe_close (lsocks_pipe);
- GNUNET_free (env_block);
- GNUNET_free (cmd);
- free (wpath);
- free (wcmd);
return NULL;
}
- GNUNET_free (env_block);
-
gnunet_proc = GNUNET_malloc (sizeof (struct GNUNET_OS_Process));
gnunet_proc->pid = proc.dwProcessId;
gnunet_proc->handle = proc.hProcess;
ResumeThread (proc.hThread);
CloseHandle (proc.hThread);
- GNUNET_free (cmd);
- free (wpath);
- free (wcmd);
if (lsocks == NULL || lsocks[0] == INVALID_SOCKET)
return gnunet_proc;
* Start a process.
*
* @param pipe_control should a pipe be used to send signals to the child?
+ * @param std_inheritance a set of GNUNET_OS_INHERIT_STD_* flags
* @param pipe_stdin pipe to use to send input to child process (or NULL)
* @param pipe_stdout pipe to use to get output from child process (or NULL)
* @param filename name of the binary
*/
struct GNUNET_OS_Process *
GNUNET_OS_start_process_vap (int pipe_control,
+ enum GNUNET_OS_InheritStdioFlags std_inheritance,
struct GNUNET_DISK_PipeHandle *pipe_stdin,
struct GNUNET_DISK_PipeHandle *pipe_stdout,
const char *filename,
char *const argv[])
{
return start_process (pipe_control,
+ std_inheritance,
pipe_stdin,
pipe_stdout,
NULL,
* Start a process.
*
* @param pipe_control should a pipe be used to send signals to the child?
+ * @param std_inheritance a set of GNUNET_OS_INHERIT_STD_* flags
* @param pipe_stdin pipe to use to send input to child process (or NULL)
* @param pipe_stdout pipe to use to get output from child process (or NULL)
* @param filename name of the binary
*/
struct GNUNET_OS_Process *
GNUNET_OS_start_process_va (int pipe_control,
+ enum GNUNET_OS_InheritStdioFlags std_inheritance,
struct GNUNET_DISK_PipeHandle *pipe_stdin,
struct GNUNET_DISK_PipeHandle *pipe_stdout,
const char *filename, va_list va)
argc++;
va_end (ap);
ret = GNUNET_OS_start_process_vap (pipe_control,
+ std_inheritance,
pipe_stdin,
pipe_stdout,
filename,
* Start a process.
*
* @param pipe_control should a pipe be used to send signals to the child?
+ * @param std_inheritance a set of GNUNET_OS_INHERIT_STD_* flags
* @param pipe_stdin pipe to use to send input to child process (or NULL)
* @param pipe_stdout pipe to use to get output from child process (or NULL)
* @param filename name of the binary
*/
struct GNUNET_OS_Process *
GNUNET_OS_start_process (int pipe_control,
+ enum GNUNET_OS_InheritStdioFlags std_inheritance,
struct GNUNET_DISK_PipeHandle *pipe_stdin,
struct GNUNET_DISK_PipeHandle *pipe_stdout,
const char *filename, ...)
va_list ap;
va_start (ap, filename);
- ret = GNUNET_OS_start_process_va (pipe_control, pipe_stdin, pipe_stdout, filename, ap);
+ ret = GNUNET_OS_start_process_va (pipe_control, std_inheritance, pipe_stdin,
+ pipe_stdout, filename, ap);
va_end (ap);
return ret;
}
*/
struct GNUNET_OS_Process *
GNUNET_OS_start_process_v (int pipe_control,
+ enum GNUNET_OS_InheritStdioFlags std_inheritance,
const SOCKTYPE *lsocks,
const char *filename,
char *const argv[])
{
return start_process (pipe_control,
+ std_inheritance,
NULL,
NULL,
lsocks,
if (NULL == opipe)
return NULL;
va_start (ap, binary);
- eip = GNUNET_OS_start_process_va (GNUNET_NO, NULL, opipe, binary, ap);
+ /* redirect stdout, don't inherit stderr/stdin */
+ eip = GNUNET_OS_start_process_va (GNUNET_NO, 0, NULL, opipe, binary, ap);
va_end (ap);
if (NULL == eip)
{
break;
}
- proc = GNUNET_OS_start_process (GNUNET_NO, NULL, pipe_stdout,
+ proc = GNUNET_OS_start_process (GNUNET_NO, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, pipe_stdout,
#if MINGW
"test_common_logging_dummy",
#else
}
proc =
- GNUNET_OS_start_process (GNUNET_NO, hello_pipe_stdin, hello_pipe_stdout, fn,
+ GNUNET_OS_start_process (GNUNET_NO, GNUNET_OS_INHERIT_STD_ERR, hello_pipe_stdin, hello_pipe_stdout, fn,
"test_gnunet_echo_hello", "-", NULL);
GNUNET_free (fn);
return 1;
}
proc =
- GNUNET_OS_start_process (GNUNET_YES, hello_pipe_stdin, hello_pipe_stdout, fn,
+ GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_ERR, hello_pipe_stdin, hello_pipe_stdout, fn,
"gnunet-service-resolver", "-", NULL);
sleep (1); /* give process time to start, so we actually use the pipe-kill mechanism! */
if (0 != GNUNET_OS_process_kill (proc, SIGTERM))
return 1;
}
proc =
- GNUNET_OS_start_process (GNUNET_YES, hello_pipe_stdin, hello_pipe_stdout, fn,
+ GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_ERR, hello_pipe_stdin, hello_pipe_stdout, fn,
"gnunet-service-resolver", "-", NULL);
if (0 != GNUNET_OS_process_kill (proc, SIGTERM))
{
pfx = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_BINDIR);
GNUNET_asprintf (&fn, "%s%cgnunet-service-resolver", pfx, DIR_SEPARATOR);
GNUNET_free (pfx);
- proc = GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, fn, "gnunet-service-resolver",
+ proc = GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, fn, "gnunet-service-resolver",
"-c", "test_resolver_api_data.conf", NULL);
GNUNET_assert (NULL != proc);
GNUNET_free (fn);