예제 #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());
        }
예제 #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)));
 }
예제 #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);
        }
예제 #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);
예제 #5
0
 /// <nodoc />
 protected static int AsyncRPCSend(ConfiguredCommand conf, IClient rpc) => RPCSend(conf, rpc, false);
예제 #6
0
 /// <nodoc />
 protected static int SyncRPCSend(ConfiguredCommand conf, IClient rpc) => RPCSend(conf, rpc, true);
예제 #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));
        }