Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ ctest FunctionalTestJigsawApollo to validate this output. [#5710](https://github
- Changed `StripPolygonSeeder` and `GridPolygonSeeder` to seed individual polygons within each images multipolygon footprint [#5193](https://github.com/DOI-USGS/ISIS3/issues/5193)
- Pinned SpiceQL to 1.2.0 [#5852](https://github.com/DOI-USGS/ISIS3/pull/5852)
- Changed `ControlMeasure` object comparison to no longer factor in creation date for equality [#5862](https://github.com/DOI-USGS/ISIS3/pull/5862)
- in Application.cpp, converted initialization environmental variable shell commands and file read to c commands. [#5906](https://github.com/DOI-USGS/ISIS3/pull/5906)

### Fixed
- Fixed Chandrayaan-2 TMC2 serial numbers by setting InstrumentId to CH2_TMC_FORE/NADIR/AFT based on the filename sensor [#5871](https://github.com/DOI-USGS/ISIS3/issues/5871)
Expand Down
41 changes: 8 additions & 33 deletions isis/src/base/objs/Application/Application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -976,46 +976,21 @@ namespace Isis {
}

/**
* Runs some printenv commands that return Isis related Enviroment Variables.
* Returns ISIS-related Enviroment Variables.
*
* @return PvlGroup containing Enviroment information
* @todo Replace printenv commands with c library getenv
* @todo
*/
PvlGroup Application::GetEnviromentInfo() {
// Create a temporary file to store console output to
FileName temp = FileName::createTempFile("$temporary/EnviromentInfo.txt");
QString tempFile = temp.expanded();

PvlGroup envGroup("EnviromentVariables");
ifstream readTemp;

QString env1 = "printenv SHELL >| " + tempFile;
QString env2 = "printenv HOME >> " + tempFile;
QString env3 = "printenv PWD >> " + tempFile;
QString env5 = "printenv ISISROOT >> " + tempFile;
QString env6 = "printenv ISISDATA >> " + tempFile;
ProgramLauncher::RunSystemCommand(env1);
ProgramLauncher::RunSystemCommand(env2);
ProgramLauncher::RunSystemCommand(env3);
ProgramLauncher::RunSystemCommand(env5);
ProgramLauncher::RunSystemCommand(env6);
// Read data from temp file
char value[511];
readTemp.open(tempFile.toLatin1().data(), ifstream::in);
readTemp.getline(value, 255);
envGroup.addKeyword(PvlKeyword("Shell", value));
readTemp.getline(value, 255);
envGroup.addKeyword(PvlKeyword("Home", value));
readTemp.getline(value, 255);
envGroup.addKeyword(PvlKeyword("Pwd", value));
readTemp.getline(value, 255);
envGroup.addKeyword(PvlKeyword("ISISROOT", value));
readTemp.getline(value, 255);
envGroup.addKeyword(PvlKeyword("ISISDATA", value));
envGroup.addKeyword(PvlKeyword("Shell", getenv("SHELL")));
envGroup.addKeyword(PvlKeyword("Home", getenv("HOME")));
envGroup.addKeyword(PvlKeyword("PWD", getenv("PWD")));
envGroup.addKeyword(PvlKeyword("ISISROOT", getenv("ISISROOT")));
envGroup.addKeyword(PvlKeyword("ISISDATA", getenv("ISISDATA")));
envGroup.addKeyword(PvlKeyword("SPICEQL_CACHE_DIR", getenv("SPICEQL_CACHE_DIR")));

// remove temp file and return
QString cleanup = "rm -f " + tempFile;
ProgramLauncher::RunSystemCommand(cleanup);
return envGroup;
}

Expand Down