Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run iCub telemetry server and openMCT visualizer in one line command: Iteration 2/2 #32

Merged
merged 5 commits into from
Sep 29, 2021

Conversation

nunoguedelha
Copy link
Collaborator

@nunoguedelha nunoguedelha commented Sep 17, 2021

Implements #25 . (iteration 2/2)

@nunoguedelha nunoguedelha added the enhancement New feature or request label Sep 17, 2021
@nunoguedelha nunoguedelha self-assigned this Sep 17, 2021
- Replaced the hardcoded nvm.sh path with path computed from NVM_DIR.
- Used require('paht').join to build paths, for more portability.
- Applied 'nvmVersion' input parameter.
- 'nvm use \<version\>' can be run from anywhere in the repo, since
  it only impacts the shell environment variables.
- Call the method in the main script.
- fix the node.js version selection: the 'PATH' variable was missing
  among those updated by "nvm use vxxx" command.
- Set the updated variables {PATH,NVM_INC,NVM_BIN} in the options of
  the spawn command running the "npm start" command.
- Warining: do not use "=" operator to copy objects, but instead the
  'Object.assign()' method.
- Inside the callbacks, for 'this' to be the 'OpenMctServerHandler'
  object instead of the callback caller, we need to back it up in a
  variable 'embeddedThis'.
@nunoguedelha
Copy link
Collaborator Author

The child process running the openmctStaticServer is already properly launched by the iCubTelemVizServer, such that we run everything by running "npm start" in the openmctStaticServer folder. But stopping the servers or aborting is still not working properly, I'm still working on it.

…nstead of 'execSync' command.

- Refactor 'OpenMctServerHandler.setNvmVersion' fo an eventual later use.
- Add '. ${NVM_DIR}/nvm.sh; nvm use vX.X.X;' in the start scripts of
  'iCubTelemVizServer' and 'openmctStaticServer'. The first instruction
  defines the 'nvm' function, while the second sets the nodejs version.
  In this case, the 'npm' process running the start script can be launched
  by a 'spawn' command. Unlike running the command 'nvm use vX.X.X' directly
  through 'spawn', using here an intermediate script ("start") avoids the
  EACCES problem encountered previously.
@nunoguedelha
Copy link
Collaborator Author

I've implemented a small improvement/simplification for handling the Node.js versions.

On top of that, the fix for properly closing the servers will be tracked in #34 , refer to #25 (comment).

So, I would consider the work complete here.

@nunoguedelha nunoguedelha marked this pull request as ready for review September 22, 2021 23:23
@nunoguedelha
Copy link
Collaborator Author

This actually simplifies the documentation. The README will be updated in #22 where also tracked the other feedback from @traversaro .

@nunoguedelha
Copy link
Collaborator Author

Hi @S-Dafarra , I'm adding you as a reviewer for avoiding to load @traversaro with this.

Copy link
Member

@S-Dafarra S-Dafarra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a curiosity regarding the portability on Windows. Also, I am not familiar at all with the language, so I was not able to provide an in depth review

iCubTelemVizServer/openMctServerHandler.js Outdated Show resolved Hide resolved
@nunoguedelha nunoguedelha removed the request for review from traversaro September 29, 2021 14:15
@nunoguedelha nunoguedelha merged commit 9d95c71 into main Sep 29, 2021
@nunoguedelha nunoguedelha deleted the feature/run-all-script-2 branch September 29, 2021 14:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants