diff --git a/.changesets/use-dir-pwd-for-capistrano-3-current-directory.md b/.changesets/use-dir-pwd-for-capistrano-3-current-directory.md new file mode 100644 index 000000000..62161afd9 --- /dev/null +++ b/.changesets/use-dir-pwd-for-capistrano-3-current-directory.md @@ -0,0 +1,6 @@ +--- +bump: "patch" +type: "fix" +--- + +Use `Dir.pwd` to determine the current directory in the Capistrano 3 integration. It previously relied on `ENV["pwd"]` which returned `nil` in some scenarios. diff --git a/lib/appsignal/integrations/capistrano/appsignal.cap b/lib/appsignal/integrations/capistrano/appsignal.cap index 750d3f1d8..0337928a8 100644 --- a/lib/appsignal/integrations/capistrano/appsignal.cap +++ b/lib/appsignal/integrations/capistrano/appsignal.cap @@ -5,7 +5,7 @@ namespace :appsignal do revision = fetch(:appsignal_revision, fetch(:current_revision)) appsignal_config = Appsignal::Config.new( - ENV["PWD"], + Dir.pwd, appsignal_env, {}, Logger.new(StringIO.new) diff --git a/spec/lib/appsignal/capistrano3_spec.rb b/spec/lib/appsignal/capistrano3_spec.rb index 55157f29b..f17e0854d 100644 --- a/spec/lib/appsignal/capistrano3_spec.rb +++ b/spec/lib/appsignal/capistrano3_spec.rb @@ -42,7 +42,11 @@ def run describe "appsignal:deploy task" do before do ENV["USER"] = "batman" - ENV["PWD"] = project_fixture_path + end + around do |example| + Dir.chdir project_fixture_path do + example.run + end end context "config" do