Skip to content

Commit 5a97bb9

Browse files
authored
[bug fix] update Env caller to use map instead of key=val array (#625)
## Summary I think this callsite was missed in #621 ## How was it tested? ``` > cd devbox/examples/php > devbox shell ``` previously this would fail with `runtime error: index out of range [1] with length 1`
1 parent f5821a8 commit 5a97bb9

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

internal/impl/devbox.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -431,8 +431,8 @@ func (d *Devbox) PluginEnv() (string, error) {
431431
return "", err
432432
}
433433
script := ""
434-
for _, pluginEnv := range pluginEnvs {
435-
script += fmt.Sprintf("export %s\n", pluginEnv)
434+
for k, v := range pluginEnvs {
435+
script += fmt.Sprintf("export %s=%s\n", k, v)
436436
}
437437
return script, nil
438438
}

internal/plugin/pkgcfg.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -138,13 +138,12 @@ func createEnvFile(pkg, projectDir string) error {
138138
return err
139139
}
140140
env := ""
141-
for _, val := range envVars {
142-
parts := strings.SplitN(val, "=", 2)
143-
escaped, err := cuecfg.MarshalJSON(parts[1])
141+
for key, val := range envVars {
142+
escaped, err := cuecfg.MarshalJSON(val)
144143
if err != nil {
145144
return errors.WithStack(err)
146145
}
147-
env += fmt.Sprintf("export %s=%s\n", parts[0], escaped)
146+
env += fmt.Sprintf("export %s=%s\n", key, escaped)
148147
}
149148
filePath := filepath.Join(projectDir, VirtenvPath, pkg, "/env")
150149
if err = createDir(filepath.Dir(filePath)); err != nil {

0 commit comments

Comments
 (0)