func (b *Bootstrap) ExtraFiles() []*os.File {
	return b.extraFiles
}
ExtraFiles returns the extra file descriptors apart from 1 & 2 to be passed to runtime
package rapidcore
import (
	"fmt"
	"os"
	"path/filepath"
	"go.amzn.com/lambda/fatalerror"
	"go.amzn.com/lambda/logging"
	"go.amzn.com/lambda/rapid"
	log "github.com/sirupsen/logrus"
)
type LogFormatter func(error) string
type BootstrapError func() (fatalerror.ErrorType, LogFormatter)
type Bootstrap struct {
	orderedLookupPaths []string
	validCmd           []string
	workingDir         string
	cmdCandidates      [][]string
	extraFiles         []*os.File
	bootstrapError     BootstrapError
}
func NewBootstrap(cmdCandidates [][]string, currentWorkingDir string) *Bootstrap {
	var orderedLookupBootstrapPaths []string
	for _, args := range cmdCandidates {
		if len(args) != 0 {
			orderedLookupBootstrapPaths = append(orderedLookupBootstrapPaths, args[0])
		}
	}
	if currentWorkingDir == "" {
		currentWorkingDir = "/"
	}
	return &Bootstrap{
		orderedLookupPaths: orderedLookupBootstrapPaths,
		workingDir:         currentWorkingDir,
		cmdCandidates:      cmdCandidates,
	}
}
func NewBootstrapSingleCmd(cmd []string, currentWorkingDir string) *Bootstrap {
	return &Bootstrap{
		validCmd:   cmd,
		workingDir: currentWorkingDir,
	}
}
func (b *Bootstrap) locateBootstrap() error {
	for i, bootstrapCandidate := range b.orderedLookupPaths {
		if file, err := os.Stat(bootstrapCandidate); !os.IsNotExist(err) && !file.IsDir() {
			b.validCmd = b.cmdCandidates[i]
			return nil
		}
	}
	log.WithField("bootstrapPathsChecked", b.orderedLookupPaths).Warn("Couldn't find valid bootstrap(s)")
	return fmt.Errorf("Couldn't find valid bootstrap(s): %s", b.orderedLookupPaths)
}
func (b *Bootstrap) Cmd() ([]string, error) {
	if len(b.validCmd) > 0 {
		return b.validCmd, nil
	}
	if err := b.locateBootstrap(); err != nil {
		return []string{}, err
	}
	log.Debug("Located runtime bootstrap", b.validCmd[0])
	return b.validCmd, nil
}
func (b *Bootstrap) Env(e rapid.EnvironmentVariables) []string {
	return e.RuntimeExecEnv()
}
func (b *Bootstrap) Cwd() (string, error) {
	if !filepath.IsAbs(b.workingDir) {
		return "", fmt.Errorf("the working directory '%s' is invalid, it needs to be an absolute path", b.workingDir)
	} else if _, err := os.Stat(b.workingDir); os.IsNotExist(err) {
		return "", fmt.Errorf("the working directory doesn't exist: %s", b.workingDir)
	}
	return b.workingDir, nil
}
func (b *Bootstrap) SetExtraFiles(extraFiles []*os.File) {
	b.extraFiles = extraFiles
}