@@ -117,30 +117,34 @@ object FuzzyC2Cpg {
117117 private val logger = LoggerFactory .getLogger(classOf [FuzzyC2Cpg ])
118118
119119 def main (args : Array [String ]): Unit = {
120- parseConfig(args).foreach { config =>
121- try {
122- val fuzzyc = new FuzzyC2Cpg ()
123-
124- if (config.usePreprocessor) {
125- fuzzyc.runWithPreprocessorAndOutput(
126- config.inputPaths,
127- config.sourceFileExtensions,
128- config.includeFiles,
129- config.includePaths,
130- config.defines,
131- config.undefines,
132- config.preprocessorExecutable,
133- Some (config.outputPath)
134- )
135- } else {
136- val cpg = fuzzyc.runAndOutput(config.inputPaths, config.sourceFileExtensions, Some (config.outputPath))
137- cpg.close()
120+ parseConfig(args) match {
121+ case Some (config) =>
122+ try {
123+ val fuzzyc = new FuzzyC2Cpg ()
124+
125+ if (config.usePreprocessor) {
126+ fuzzyc.runWithPreprocessorAndOutput(
127+ config.inputPaths,
128+ config.sourceFileExtensions,
129+ config.includeFiles,
130+ config.includePaths,
131+ config.defines,
132+ config.undefines,
133+ config.preprocessorExecutable,
134+ Some (config.outputPath)
135+ )
136+ } else {
137+ val cpg = fuzzyc.runAndOutput(config.inputPaths, config.sourceFileExtensions, Some (config.outputPath))
138+ cpg.close()
139+ }
140+
141+ } catch {
142+ case NonFatal (ex) =>
143+ logger.error(" Failed to generate CPG." , ex)
144+ System .exit(1 )
138145 }
139-
140- } catch {
141- case NonFatal (ex) =>
142- logger.error(" Failed to generate CPG." , ex)
143- }
146+ case _ =>
147+ System .exit(1 )
144148 }
145149 }
146150
0 commit comments