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

Function writeGlobalProcessComposeJSON

internal/services/manager.go:70–86  ·  view source on GitHub ↗
(config *globalProcessComposeConfig, file *os.File)

Source from the content-addressed store, hash-verified

68}
69
70func writeGlobalProcessComposeJSON(config *globalProcessComposeConfig, file *os.File) error {
71 // convert config to json using cue
72 json, err := cuecfg.MarshalJSON(config.Instances)
73 if err != nil {
74 return fmt.Errorf("failed to convert config to json: %w", err)
75 }
76
77 if err := file.Truncate(0); err != nil {
78 return fmt.Errorf("failed to truncate global config file: %w", err)
79 }
80
81 if _, err := file.Write(json); err != nil {
82 return fmt.Errorf("failed to write global config file: %w", err)
83 }
84
85 return nil
86}
87
88func openGlobalConfigFile() (*os.File, error) {
89 configPath, err := globalProcessComposeJSONPath()

Callers 5

StopProcessManagerFunction · 0.85
StopAllProcessManagersFunction · 0.85
ProcessManagerIsRunningFunction · 0.85

Calls 2

MarshalJSONFunction · 0.92
WriteMethod · 0.80

Tested by

no test coverage detected