From e50ae1a1d3fe781da4106a8054617cad3d0fe6a0 Mon Sep 17 00:00:00 2001 From: Ryan Mulligan <ryan@ryantm.com> Date: Wed, 8 Jan 2025 17:00:58 -0800 Subject: [PATCH] fix: set process working dir based on relative path of -f file too Why === * extends now sets the working dir of the processes in it based on the relative path of the process-compose file. * The documentation says that -f should be equvalent to using extends * However, -f does not set the workign dir of the process to match the process-compose file's path * To make the documentation consistent again, we should also set the working dir for the -f filename case. What changed === * Move the working dir copy from loadExtendProject to loadProjectFromFile Test plan === * -f and extends both set the expected working dir of the processes in my local tests --- src/loader/loader.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/loader/loader.go b/src/loader/loader.go index 7d759d7..e3bff31 100644 --- a/src/loader/loader.go +++ b/src/loader/loader.go @@ -93,7 +93,6 @@ func loadExtendProject(p *types.Project, opts *LoaderOptions, file string, index log.Error().Err(err).Msgf("Failed to load the extend project %s", p.ExtendsProject) return fmt.Errorf("failed to load extend project %s: %w", p.ExtendsProject, err) } - copyWorkingDirToProcesses(project, filepath.Dir(p.ExtendsProject)) opts.projects = slices.Insert(opts.projects, index, project) err = loadExtendProject(project, opts, p.ExtendsProject, index) if err != nil { @@ -161,6 +160,7 @@ func loadProjectFromFile(inputFile string, opts *LoaderOptions) (*types.Project, } } + copyWorkingDirToProcesses(project, filepath.Dir(inputFile)) log.Info().Msgf("Loaded project from %s", inputFile) return project, nil }