Example #1
0
        private static IIpcResult RPCSendCore(ConfiguredCommand conf, IClient rpc, bool isSync)
        {
            string operationPayload = ToPayload(conf);
            var    operation        = new IpcOperation(operationPayload, waitForServerAck: isSync);

            return(rpc.Send(operation).GetAwaiter().GetResult());
        }
Example #2
0
 /// <summary>
 /// Creates DaemonConfig using the values specified on the ConfiguredCommand
 /// </summary>
 public static DaemonConfig CreateDaemonConfig(ConfiguredCommand conf)
 {
     return(new DaemonConfig(
                logger: conf.Logger,
                moniker: conf.Get(Moniker),
                maxConnectRetries: conf.Get(MaxConnectRetries),
                connectRetryDelay: TimeSpan.FromMilliseconds(conf.Get(ConnectRetryDelayMillis)),
                stopOnFirstFailure: conf.Get(StopOnFirstFailure),
                enableCloudBuildIntegration: conf.Get(EnableCloudBuildIntegration)));
 }
Example #3
0
        /// <nodoc />
        protected static int RPCSend(ConfiguredCommand conf, IClient rpc, bool isSync)
        {
            var rpcResult = RPCSendCore(conf, rpc, isSync);

            conf.Logger.Info(
                "Command '{0}' {1} (exit code: {2}). {3}",
                conf.Command.Name,
                rpcResult.Succeeded ? "succeeded" : "failed",
                (int)rpcResult.ExitCode,
                rpcResult.Payload);
            return((int)rpcResult.ExitCode);
        }
Example #4
0
 /// <summary>
 /// Reconstructs a full command line corresponding to a <see cref="ConfiguredCommand"/>.
 /// </summary>
 private static string ToPayload(ConfiguredCommand cmd) => ToPayload(cmd.Command.Name, cmd.Config);
Example #5
0
 /// <nodoc />
 protected static int AsyncRPCSend(ConfiguredCommand conf, IClient rpc) => RPCSend(conf, rpc, false);
Example #6
0
 /// <nodoc />
 protected static int SyncRPCSend(ConfiguredCommand conf, IClient rpc) => RPCSend(conf, rpc, true);
Example #7
0
        /// <summary>
        /// Creates anIPC client using the config from a ConfiguredCommand
        /// </summary>
        public static IClient CreateClient(ConfiguredCommand conf)
        {
            var daemonConfig = CreateDaemonConfig(conf);

            return(IpcProvider.GetClient(daemonConfig.Moniker, daemonConfig));
        }