Remote developement: upload files automatically only when remote profile is selected and execute cutom script on connection

Answered

I am using the new CLion 2018.3.2 and really like the remote developement features. I am just wondering if it is possible to only enable the automatic file upload when a remote profile is selected. Currently, when I have a local profile selected and am not connected to the remote, I get error messages because the files can not be uploaded.

Also, is it possible to execute a custom script whenever CLion is connecting to the remote? I need this, because I am using a managed remote server where the required software has to be loaded via modules. Currently I am using the .bashrc file to load modules, but this is suboptimal because I want to use different modules for different projects.

Many thanks in advance!

1
5 comments

Hi Richard!

About uploading: it's https://youtrack.jetbrains.com/issue/CPP-14312, should be fixed in CLion 2019.1 EAP expected this month.

About script: could you please specify at what moment it should be executed? After the connection is successfully established?

0
Avatar
Permanently deleted user

Hi Anna,

thank you for getting back to me. I will try the fix in the new CLion version once it is public.

Concerning the script: Yes, I would like to have it executed after a successful connection. To further illustrate: I am using remote machines that are part of a larger cluster. After connecting, I have to load modules, for example to load a specific compiler. So after a succesful connection I would like to execute the command "module add GCC" for example. I hope that makes it more clear what I am trying to achieve.

0

Richard, thanks for the clarification! Unfortunately, for now there is no such option to automatically execute a script. Please note that there is a embedded local terminal in CLion where you can use the command line mode without leaving the IDE. So you can execute a request command there. Could you please try it? Does it work this way?

0
Avatar
Permanently deleted user

I don't think the emedded local terminal would work, because:

1. The command/script has to be executed on the remote machine, and not locally.
2. The command/script has to be executed every time CLion connects to the remote machine.

I guess that if I press "Run" in CLion with an active remote developement profile, it basically works something like this:

1. Use rsync to sync changed files.
2. Connect to remote machine via ssh.
3. Execute make.
4. Execute target.

I would like the script to be executed between steps 2 and 3:

1. Use rsync to sync changed files.
2. Connect to remote machine via ssh.
*Execute custom command/script*
3. Execute make.
4. Execute target.

0

Richard, thank you for the details. Looks like the only thing we can suggest currently is adding an additional "Before launch" step to a run/debug configuration, namely the "Run Remote External tool" step before the "Build" step:

Not sure it'll solve the issue, but worth trying.

0

Please sign in to leave a comment.