(devbox devboxer, name string)
| 114 | } |
| 115 | |
| 116 | func createScriptFile(devbox devboxer, name string) (script *os.File, err error) { |
| 117 | script, err = os.Create(ScriptPath(devbox.ProjectDir(), name)) |
| 118 | if err != nil { |
| 119 | return nil, errors.WithStack(err) |
| 120 | } |
| 121 | defer func() { |
| 122 | // best effort: close file if there was some subsequent error |
| 123 | if err != nil { |
| 124 | _ = script.Close() |
| 125 | } |
| 126 | }() |
| 127 | |
| 128 | err = script.Chmod(0o755) |
| 129 | if err != nil { |
| 130 | return nil, errors.WithStack(err) |
| 131 | } |
| 132 | return script, nil |
| 133 | } |
| 134 | |
| 135 | func ScriptPath(projectDir, scriptName string) string { |
| 136 | return filepath.Join(projectDir, scriptsDir, scriptName+".sh") |
no test coverage detected