MCPcopy Create free account
hub / github.com/GongShichen/LuminaCode / linuxSandbox

Method linuxSandbox

tools/bash/sandbox.go:125–160  ·  view source on GitHub ↗
(command string, config SandboxConfig, cwd string)

Source from the content-addressed store, hash-verified

123 m.options.WSLDistro = strings.TrimSpace(options.WSLDistro)
124 }
125 if strings.TrimSpace(options.WSLInstallDir) != "" {
126 m.options.WSLInstallDir = strings.TrimSpace(options.WSLInstallDir)
127 }
128 if strings.TrimSpace(options.WSLImageURL) != "" {
129 m.options.WSLImageURL = strings.TrimSpace(options.WSLImageURL)
130 }
131 if strings.TrimSpace(options.WSLImagePath) != "" {
132 m.options.WSLImagePath = strings.TrimSpace(options.WSLImagePath)
133 }
134 if strings.TrimSpace(options.WSLImageSHA256) != "" {
135 m.options.WSLImageSHA256 = strings.ToLower(strings.TrimSpace(options.WSLImageSHA256))
136 }
137 m.options.WSLAllowLocalFallback = options.WSLAllowLocalFallback
138}
139
140func (m *SandboxManager) GetSandboxCommand(command string, config SandboxConfig, cwd string) []string {
141 if !config.Enabled || !m.IsSandboxingEnabled() {
142 return nil
143 }
144 switch m.effectiveBackend() {
145 case "macos":
146 return m.macosSandbox(command, config, cwd)
147 case "local-bwrap":
148 return m.linuxSandbox(command, config, cwd)
149 case "wsl-bwrap":
150 return m.wslSandbox(command, config, cwd)
151 default:
152 return nil
153 }
154}
155
156func (m *SandboxManager) NeedsSetup(command string, dangerouslyDisableSandbox bool) bool {
157 if m == nil || !m.enabled || dangerouslyDisableSandbox {
158 return false
159 }
160 if m.effectiveBackend() != "wsl-bwrap" || m.platform != "windows" {
161 return false
162 }
163 if IsSandboxExcludedCommand(command, nil) {

Callers 1

GetSandboxCommandMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected