Skip to content

Commit 7c83d18

Browse files
committed
Fix temporary user-data-dir not removed after stop
When the `Ferrum::Browser::Process` is garbage collected the temporary `user-data-dir` is correctly removed, but if `#stop` has been called then this directory is never removed. That's because `#stop` only removes the directory if `@user_data_dir` is set (and then clears the finalizer) and the initialization of `@user_data_dir` has been mistakenly removed in d98d1f9. This patch puts back the initialization of this variable and fixes the problem. This time the initialization is on its own line to make it clear we want this instance variable to be defined.
1 parent 1a33d43 commit 7c83d18

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/ferrum/browser/process.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,12 @@ def initialize(options)
6464
return
6565
end
6666

67-
@user_data_dir = nil
6867
@logger = options[:logger]
6968
@process_timeout = options.fetch(:process_timeout, PROCESS_TIMEOUT)
7069

7170
tmpdir = Dir.mktmpdir
7271
ObjectSpace.define_finalizer(self, self.class.directory_remover(tmpdir))
72+
@user_data_dir = tmpdir
7373
@command = Command.build(options, tmpdir)
7474
end
7575

0 commit comments

Comments
 (0)