File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed
Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -159,6 +159,11 @@ pub fn analyze_python_licenses(package_file_path: &str) -> Vec<LicenseInfo> {
159159
160160/// Analyze the licenses of JavaScript dependencies
161161pub fn analyze_js_licenses ( package_json_path : & str ) -> Vec < LicenseInfo > {
162+ #[ cfg( windows) ]
163+ const NPM : & str = "npm.cmd" ;
164+ #[ cfg( not( windows) ) ]
165+ const NPM : & str = "npm" ;
166+
162167 let content = fs:: read_to_string ( package_json_path) . expect ( "Failed to read package.json file" ) ;
163168 let package_json: PackageJson =
164169 serde_json:: from_str ( & content) . expect ( "Failed to parse package.json" ) ;
@@ -168,7 +173,7 @@ pub fn analyze_js_licenses(package_json_path: &str) -> Vec<LicenseInfo> {
168173 all_dependencies
169174 . par_iter ( )
170175 . map ( |( name, version) | {
171- let output = Command :: new ( "npm" )
176+ let output = Command :: new ( NPM )
172177 . arg ( "view" )
173178 . arg ( name)
174179 . arg ( "version" )
You can’t perform that action at this time.
0 commit comments