File tree Expand file tree Collapse file tree 3 files changed +9
-2
lines changed Expand file tree Collapse file tree 3 files changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -61,6 +61,7 @@ pub fn run(options: Options) -> std::io::Result<()> {
61
61
} ,
62
62
] ,
63
63
trap_dir : options. output_dir ,
64
+ trap_compression : trap:: Compression :: from_env ( "CODEQL_QL_TRAP_COMPRESSION" ) ,
64
65
source_archive_dir : options. source_archive_dir ,
65
66
file_list : options. file_list ,
66
67
} ;
Original file line number Diff line number Diff line change @@ -22,6 +22,10 @@ pub struct Extractor {
22
22
pub trap_dir : PathBuf ,
23
23
pub source_archive_dir : PathBuf ,
24
24
pub file_list : PathBuf ,
25
+ // Typically constructed via `trap::Compression::from_env`.
26
+ // This allow us to report the error using our diagnostics system
27
+ // without exposing it to consumers.
28
+ pub trap_compression : Result < trap:: Compression , String > ,
25
29
}
26
30
27
31
impl Extractor {
@@ -52,8 +56,8 @@ impl Extractor {
52
56
"threads"
53
57
}
54
58
) ;
55
- let trap_compression = match trap :: Compression :: from_env ( "CODEQL_QL_TRAP_COMPRESSION" ) {
56
- Ok ( x) => x,
59
+ let trap_compression = match & self . trap_compression {
60
+ Ok ( x) => * x,
57
61
Err ( e) => {
58
62
main_thread_logger. write (
59
63
main_thread_logger
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ use std::io::{Read, Write};
3
3
use std:: path:: { Path , PathBuf } ;
4
4
5
5
use codeql_extractor:: extractor:: simple;
6
+ use codeql_extractor:: trap;
6
7
use flate2:: read:: GzDecoder ;
7
8
use tree_sitter_ql;
8
9
@@ -47,6 +48,7 @@ fn simple_extractor() {
47
48
trap_dir,
48
49
source_archive_dir,
49
50
file_list,
51
+ trap_compression : Ok ( trap:: Compression :: Gzip ) ,
50
52
} ;
51
53
52
54
// The extractor should run successfully
You can’t perform that action at this time.
0 commit comments