Skip to content

Commit

Permalink
shell - chrooting on srv/ sub-directory when 'app run' command is lau…
Browse files Browse the repository at this point in the history
…nched from a directory not containing a md.restx.json file.

This fixes #188
  • Loading branch information
fcamblor committed Sep 9, 2017
1 parent 6772f7e commit dca208d
Showing 1 changed file with 22 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit dca208d

Please sign in to comment.