static bool arg_expect_reply = true;
static bool arg_auto_start = true;
static bool arg_allow_interactive_authorization = true;
+static usec_t arg_timeout = 0;
static void pager_open_if_enabled(void) {
return 0;
}
- r = sd_bus_call(bus, m, 0, &error, &reply);
+ r = sd_bus_call(bus, m, arg_timeout, &error, &reply);
if (r < 0) {
log_error("%s", bus_error_message(&error, r));
return r;
return -EINVAL;
}
- r = sd_bus_call(bus, m, 0, &error, NULL);
+ r = sd_bus_call(bus, m, arg_timeout, &error, NULL);
if (r < 0) {
log_error("%s", bus_error_message(&error, r));
return r;
" --expect-reply=BOOL Expect a method call reply\n"
" --auto-start=BOOL Auto-start destination service\n"
" --allow-interactive-authorization=BOOL\n"
- " Allow interactive authorization for operation\n\n"
+ " Allow interactive authorization for operation\n"
+ " --timeout=SECS Maximum time to wait for method call completion\n\n"
"Commands:\n"
" list List bus names\n"
" status SERVICE Show service name status\n"
ARG_EXPECT_REPLY,
ARG_AUTO_START,
ARG_ALLOW_INTERACTIVE_AUTHORIZATION,
+ ARG_TIMEOUT,
};
static const struct option options[] = {
{ "expect-reply", required_argument, NULL, ARG_EXPECT_REPLY },
{ "auto-start", required_argument, NULL, ARG_AUTO_START },
{ "allow-interactive-authorization", required_argument, NULL, ARG_ALLOW_INTERACTIVE_AUTHORIZATION },
+ { "timeout", required_argument, NULL, ARG_TIMEOUT },
{},
};
arg_allow_interactive_authorization = !!r;
break;
+ case ARG_TIMEOUT:
+ r = parse_sec(optarg, &arg_timeout);
+ if (r < 0) {
+ log_error("Failed to parse --timeout= parameter.");
+ return r;
+ }
+
+ break;
+
case '?':
return -EINVAL;