예제 #1
0
 /// <summary>
 /// Creates a DockerShim wrapper and executes the application logic within that wrapper.
 /// </summary>
 /// <param name="settings">The settings to use for the DockerShim wrapper.</param>
 /// <param name="action">The application logic to execute.</param>
 public static int Main(DockerShimSettings settings, Func <DockerShimContext, Task> action)
 {
     return(Main(settings, async context =>
     {
         await action(context).ConfigureAwait(false);
         return c_successExitCode;
     }));
 }
예제 #2
0
        /// <summary>
        /// Creates a DockerShim wrapper with the specified settings.
        /// </summary>
        /// <param name="settings">The settings to use.</param>
        private DockerShimRunner(DockerShimSettings settings)
        {
            m_settings      = settings;
            m_log           = m_settings.LoggerFactory.CreateLogger("DockerShim");
            m_exitRequested = new CancellationTokenSource();
            var loggingConsoleStdout =
                new StringLogTextWriter(new LoggingStringLog(m_settings.LoggerFactory, m_settings.StdoutParser));

            m_context       = new DockerShimContext(m_settings.LoggerFactory, m_exitRequested.Token, loggingConsoleStdout);
            m_done          = new ManualResetEventSlim();
            m_exitCodeMutex = new object();
        }
예제 #3
0
#pragma warning restore

        /// <summary>
        /// Creates a DockerShim wrapper and executes the application logic within that wrapper.
        /// </summary>
        /// <param name="settings">The settings to use for the DockerShim wrapper.</param>
        /// <param name="action">The application logic to execute.</param>
        public static int Main(DockerShimSettings settings, Action <DockerShimContext> action) => Main(settings, context =>
        {
            action(context);
            return(c_successExitCode);
        });
예제 #4
0
#pragma warning disable 1998
        /// <summary>
        /// Creates a DockerShim wrapper and executes the application logic within that wrapper.
        /// </summary>
        /// <param name="settings">The settings to use for the DockerShim wrapper.</param>
        /// <param name="action">The application logic to execute.</param>
        public static int Main(DockerShimSettings settings, Func <DockerShimContext, int> action) =>
        Main(settings, async context => action(context));
예제 #5
0
        /// <summary>
        /// Creates a DockerShim wrapper and executes the application logic within that wrapper.
        /// </summary>
        /// <param name="settings">The settings to use for the DockerShim wrapper.</param>
        /// <param name="action">The application logic to execute.</param>
        public static int Main(DockerShimSettings settings, Func <DockerShimContext, Task <int> > action)
        {
            var runner = new DockerShimRunner(settings);

            return(runner.Run(action));
        }