MCPcopy Index your code
hub / github.com/jetify-com/devbox / createScriptFile

Function createScriptFile

internal/shellgen/scripts.go:116–133  ·  view source on GitHub ↗
(devbox devboxer, name string)

Source from the content-addressed store, hash-verified

114}
115
116func 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
135func ScriptPath(projectDir, scriptName string) string {
136 return filepath.Join(projectDir, scriptsDir, scriptName+".sh")

Callers 2

writeRawInitHookFileFunction · 0.85
WriteScriptFileFunction · 0.85

Calls 2

ScriptPathFunction · 0.85
ProjectDirMethod · 0.65

Tested by

no test coverage detected