summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorÁrni Dagur <agudmundsson@fc-md.umd.edu>2020-05-04 22:03:35 -0400
committerÁrni Dagur <agudmundsson@fc-md.umd.edu>2020-05-04 22:03:35 -0400
commit05f646792baf08121e6e8b3f798551714194d153 (patch)
tree969159741d4fab1af15e668d0dcf5a6b8d848a6e
parente9c68701334fa5ccf464418399a7aef14752b0bc (diff)
Gag stderr for 'add_filter_list'
-rw-r--r--Cargo.toml1
-rw-r--r--src/lib.rs4
2 files changed, 5 insertions, 0 deletions
diff --git a/Cargo.toml b/Cargo.toml
index c013260..9a5b1d0 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -11,6 +11,7 @@ debug = true
11[dependencies] 11[dependencies]
12adblock = "0.2.8" 12adblock = "0.2.8"
13pyo3 = "0.9" 13pyo3 = "0.9"
14gag = "0.1"
14 15
15[lib] 16[lib]
16name="adblock" 17name="adblock"
diff --git a/src/lib.rs b/src/lib.rs
index 0fa3b39..2b93162 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -18,6 +18,7 @@ use pyo3::class::PyObjectProtocol;
18use pyo3::exceptions::ValueError as PyValueError; 18use pyo3::exceptions::ValueError as PyValueError;
19use pyo3::prelude::*; 19use pyo3::prelude::*;
20use pyo3::PyErr; 20use pyo3::PyErr;
21use gag::Gag;
21 22
22use std::collections::HashMap; 23use std::collections::HashMap;
23use std::collections::HashSet; 24use std::collections::HashSet;
@@ -350,6 +351,9 @@ impl Engine {
350 /// Add the contents of a block list file to the blocking engine. 351 /// Add the contents of a block list file to the blocking engine.
351 #[text_signature = "($self, filter_list)"] 352 #[text_signature = "($self, filter_list)"]
352 pub fn add_filter_list(&mut self, filter_list: &str) { 353 pub fn add_filter_list(&mut self, filter_list: &str) {
354 // Gag the any messages to stderr. This is necessary until issue
355 // https://github.com/brave/adblock-rust/issues/88 is closed.
356 let _stderr_gag = Gag::stderr();
353 self.engine.add_filter_list(filter_list); 357 self.engine.add_filter_list(filter_list);
354 } 358 }
355 359