mirror of
https://github.com/cincheo/jsweet.git
synced 2025-12-15 15:29:22 +00:00
fix NPE in global npm package lookup
This commit is contained in:
parent
a7bc751ec6
commit
8d48e0a410
@ -125,11 +125,8 @@ public class ProcessUtil {
|
|||||||
|
|
||||||
logger.info("cannot find " + command + " - searching in node_modules files");
|
logger.info("cannot find " + command + " - searching in node_modules files");
|
||||||
unixPath = lookupGlobalNpmPackageExecutablePath(NPM_DIR, command);
|
unixPath = lookupGlobalNpmPackageExecutablePath(NPM_DIR, command);
|
||||||
if (unixPath != null) {
|
|
||||||
return unixPath;
|
return unixPath;
|
||||||
}
|
|
||||||
|
|
||||||
throw new RuntimeException("cannot find executable " + command);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -184,14 +181,16 @@ public class ProcessUtil {
|
|||||||
* Tells if this node command is globally installed.
|
* Tells if this node command is globally installed.
|
||||||
*/
|
*/
|
||||||
public static boolean isExecutableInstalledGloballyWithNpm(String command) {
|
public static boolean isExecutableInstalledGloballyWithNpm(String command) {
|
||||||
return new File(getGlobalNpmPackageExecutablePath(command)).exists();
|
String executablePath = getGlobalNpmPackageExecutablePath(command);
|
||||||
|
return executablePath != null && new File(executablePath).exists();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tells if this node command is locally or globally installed
|
* Tells if this node command is locally or globally installed
|
||||||
*/
|
*/
|
||||||
public static boolean isExecutableInstalledLocallyWithNpm(String command, File projectDirectory) {
|
public static boolean isExecutableInstalledLocallyWithNpm(String command, File projectDirectory) {
|
||||||
return new File(getLocalNpmPackageExecutablePath(command, projectDirectory)).exists();
|
String executablePath = getLocalNpmPackageExecutablePath(command, projectDirectory);
|
||||||
|
return executablePath != null && new File(executablePath).exists();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user