Permalink
Browse files

shell - chrooting on srv/ sub-directory when 'app run' command is lau…

…nched from a directory not containing a md.restx.json file.

This fixes #188
  • Loading branch information...
fcamblor committed Aug 27, 2017
1 parent 6772f7e commit dca208df49ae98c60fb3dff4d95d90b9400195c2
Showing with 22 additions and 0 deletions.
  1. +22 −0 restx-core-shell/src/main/java/restx/core/shell/AppShellCommand.java
@@ -611,6 +611,28 @@ public void run(final RestxShell shell) throws Exception {
shell.cd(standardCachedAppPath(appNameArg.get()));
}
if(!ModuleDescriptorType.RESTX.resolveDescriptorFile(shell.currentLocation()).exists()) {
Path srvDir = shell.currentLocation().resolve("srv");
if(srvDir.toFile().exists()) {
shell.cd(srvDir);
if(!ModuleDescriptorType.RESTX.resolveDescriptorFile(shell.currentLocation()).exists()) {
shell.println(String.format("Cannot find %s in both %s and %s",
ModuleDescriptorType.RESTX.getDescriptorFileName(),
shell.currentLocation().getParent().toAbsolutePath(),
shell.currentLocation().toAbsolutePath()));
shell.println("=> Cannot run application");
return;
}
} else {
shell.println(String.format("Cannot find %s in %s",
ModuleDescriptorType.RESTX.getDescriptorFileName(),
shell.currentLocation().toAbsolutePath()));
shell.println("=> Cannot run application");
return;
}
}
boolean sourcesAvailable = Apps.with(shell.getFactory().getComponent(AppSettings.class)).sourcesAvailableIn(shell.currentLocation());
String appClassName;

0 comments on commit dca208d

Please sign in to comment.