File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -61,6 +61,7 @@ pub fn run(options: Options) -> std::io::Result<()> {
6161 } ,
6262 ] ,
6363 trap_dir : options. output_dir ,
64+ trap_compression : trap:: Compression :: from_env ( "CODEQL_QL_TRAP_COMPRESSION" ) ,
6465 source_archive_dir : options. source_archive_dir ,
6566 file_list : options. file_list ,
6667 } ;
Original file line number Diff line number Diff line change @@ -22,6 +22,10 @@ pub struct Extractor {
2222 pub trap_dir : PathBuf ,
2323 pub source_archive_dir : PathBuf ,
2424 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 > ,
2529}
2630
2731impl Extractor {
@@ -52,8 +56,8 @@ impl Extractor {
5256 "threads"
5357 }
5458 ) ;
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,
5761 Err ( e) => {
5862 main_thread_logger. write (
5963 main_thread_logger
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ use std::io::{Read, Write};
33use std:: path:: { Path , PathBuf } ;
44
55use codeql_extractor:: extractor:: simple;
6+ use codeql_extractor:: trap;
67use flate2:: read:: GzDecoder ;
78use tree_sitter_ql;
89
@@ -47,6 +48,7 @@ fn simple_extractor() {
4748 trap_dir,
4849 source_archive_dir,
4950 file_list,
51+ trap_compression : Ok ( trap:: Compression :: Gzip ) ,
5052 } ;
5153
5254 // The extractor should run successfully
You can’t perform that action at this time.
0 commit comments