func NewRunCmd(o *globals.GlobalOpts) *cli.Command {
	runDirectoryExpression := moreos.ReplacePathSeparator("$FUNC_E_HOME/runs/$epochtime")
	cmd := &cli.Command{
		Name:            "run",
		Usage:           "Run Envoy with the given [arguments...] until interrupted",
		ArgsUsage:       "[arguments...]",
		SkipFlagParsing: true,
		Description: moreos.Sprintf(`To run Envoy, execute ` + "`func-e run -c your_envoy_config.yaml`" + `.
The first version in the below is run, controllable by the "use" command:
` + fmt.Sprintf("```\n%s\n```", envoy.VersionUsageList()) + `
The version to use is downloaded and installed, if necessary.
Envoy interprets the '[arguments...]' and runs in the current working
directory (aka $PWD) until func-e is interrupted (ex Ctrl+C, Ctrl+Break).
Envoy's process ID and console output write to "envoy.pid", stdout.log" and
"stderr.log" in the run directory (` + fmt.Sprintf("`%s`", runDirectoryExpression) + `).
When interrupted, shutdown hooks write files including network and process
state. On exit, these archive into ` + fmt.Sprintf("`%s.tar.gz`", runDirectoryExpression)),
		Before: func(c *cli.Context) error {
			return ensureEnvoyVersion(c, o)
		},
		Action: func(c *cli.Context) error {
			if err := initializeRunOpts(c.Context, o, o.EnvoyVersion); err != nil {
				return err
			}
			r := envoy.NewRuntime(&o.RunOpts)
			stdoutLog, err := os.OpenFile(filepath.Join(r.GetRunDir(), "stdout.log"), os.O_CREATE|os.O_WRONLY, 0600)
			if err != nil {
				return fmt.Errorf("couldn't create stdout log file: %w", err)
			}
			defer stdoutLog.Close() //nolint
			r.OutFile = stdoutLog
			r.Out = io.MultiWriter(c.App.Writer, stdoutLog)
			stderrLog, err := os.OpenFile(filepath.Join(r.GetRunDir(), "stderr.log"), os.O_CREATE|os.O_WRONLY, 0600)
			if err != nil {
				return fmt.Errorf("couldn't create stderr log file: %w", err)
			}
			defer stderrLog.Close() //nolint
			r.ErrFile = stderrLog
			r.Err = io.MultiWriter(c.App.ErrWriter, stderrLog)
			for _, enableShutdownHook := range shutdown.EnableHooks {
				if err := enableShutdownHook(r); err != nil {
					moreos.Fprintf(r.Out, "failed to enable shutdown hook: %s\n", err)  
				}
			}
			return r.Run(c.Context, c.Args().Slice())
		},
		CustomHelpTemplate: moreos.Sprintf(cli.CommandHelpTemplate),
	}
	return cmd
}
NewRunCmd create a command responsible for starting an Envoy process
package cmd
import (
	"context"
	"fmt"
	"io"
	"os"
	"path/filepath"
	"strconv"
	"time"
	"github.com/urfave/cli/v2"
	"github.com/tetratelabs/func-e/internal/envoy"
	"github.com/tetratelabs/func-e/internal/envoy/shutdown"
	"github.com/tetratelabs/func-e/internal/globals"
	"github.com/tetratelabs/func-e/internal/moreos"
	"github.com/tetratelabs/func-e/internal/version"
)