Ejemplo n.º 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;
     }));
 }
Ejemplo n.º 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();
        }
Ejemplo n.º 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);
        });
Ejemplo n.º 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));
Ejemplo n.º 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));
        }