назначение окружения PATH LD_LIBRARY_PATH

++
This commit is contained in:
2025-03-09 21:35:34 +03:00
parent d2a333c7cb
commit c85661a264
9 changed files with 39 additions and 37 deletions

View File

@@ -3,8 +3,8 @@ import Common.Utils.Vector_;
import java.util.Vector;
public class Constants {
public static final int version = 1203;
public static final int planner_version = 12;
public static final int version = 1204;
public static final int planner_version = 15;
public static final int testingMaxKernels = 64;
//--
public static final String ApplicationFileName = "VisualSapfor.jar";

View File

@@ -225,9 +225,6 @@ public abstract class RepositoryServer<D extends Database> {
case ReceiveFile:
ReceiveFile();
break;
case Email:
Email();
break;
default:
UnsafeSession();
break;

View File

@@ -8,3 +8,5 @@ int maxKernels;
int busyKernels;
int freeKernels;
String dvm_drv;
String PATH;
String LD_LIBRARY_PATH;

View File

@@ -91,12 +91,9 @@ public:
}
String getStartCommand() override {
String res = workspace + "/run";
String res = Task::getStartCommand();
if (!environments.isEmpty())
res = environments + " " + res;
#if DEB
printf("START %ld: %s\n", id, res.getCharArray());
#endif
return res;
}

View File

@@ -122,9 +122,13 @@ public:
virtual void prepareWorkspace() {}
virtual String getLaunchScriptText() = 0;
virtual String getStartCommand() {
return workspace + "/run";
String res = workspace + "/run";
if (!PATH.isEmpty())
res = "PATH="+String::DQuotes(PATH)+ " " + res;
if (!LD_LIBRARY_PATH.isEmpty())
res = "LD_LIBRARY_PATH="+String::DQuotes(LD_LIBRARY_PATH)+ " " + res;
return res;
}
void createWorkspace() {
Utils::Mkdir(workspace);
}

View File

@@ -88,6 +88,14 @@ void set_handlers() {
#endif
}
void getEnv_(String& res, const char * name_in){
char * value_ = getenv(name_in);
if (value_ != NULL){
res = String(value_);
value_ = NULL;
}
}
int main(int argc, char ** argv)
{
//+
@@ -101,18 +109,20 @@ int main(int argc, char ** argv)
freeKernels = maxKernels;
busyKernels= 0;
//--
getEnv_(PATH,"PATH");
getEnv_(LD_LIBRARY_PATH,"LD_LIBRARY_PATH");
//--
("PATH="+PATH).println();
("LD_LIBRARY_PATH="+LD_LIBRARY_PATH).println();
//--
#if __cplusplus >= 201703L
std::filesystem::current_path(packageWorkspace.getCharArray());
#else
chdir(packageWorkspace.getCharArray());
#endif
#if DEB
userWorkspace.println();
packageWorkspace.println();
printf("%d\n", maxKernels);
#endif
#ifndef _WIN32
int pid = getpid();
@@ -120,29 +130,17 @@ int main(int argc, char ** argv)
int pid = _getpid();
#endif
#if DEB
printf("PID=%d\n", pid);
#endif
File pidFile("PID", String(pid)+"\n");
pidFile.Close();
//---
File startFile("STARTED", "+");
startFile.Close();
//---
#if DEB
printf(">>>>\n");
#endif
CompilationSupervisor * compilationSupervisor = new CompilationSupervisor();
#if DEB
printf("%ld\n", compilationSupervisor->getLength());
#endif
compilationSupervisor->DoWithSchedule(maxKernels);
RunSupervisor * runSupervisor = new RunSupervisor(compilationSupervisor);
#if DEB
printf("%ld\n", runSupervisor->getLength());
runSupervisor->print();
#endif
RunSupervisor * runSupervisor = new RunSupervisor(compilationSupervisor);
runSupervisor->DoWithSchedule(maxKernels);
return 0;
}

View File

@@ -1 +1 @@
13
15