Sublime Forum

Multiple sublime processes with different environment

#1

Hi group
I have several shell windows open, each with different env-vars affecting my compilation process. How can I start another sublime process from a shell?

If sublime is already started from a different terminal (with different env) then doing: ‘subl ./main.cpp’ just opens file in previously existing editor - not what I’d want.

Is there any workaround for this ? Like ‘subl --new-proc’ maybe ?

thanks for any tips !
-michal

0 Likes

#2

You can open a new window with subl -n ./main.cpp. It will use the same process and not inherit the new shell’s env, however.

You might have to look into other ways of infering the shell’s or project’s env into your build process.

0 Likes

#3

Yes, I need many different processes/envs at the same time. Is it possible ?

0 Likes

#4

When you invoke subl or sublime_text from the command line, it talks to the existing process to tell it what to do.

As such the only way I know of to have two instances running at the same time is to run the second copy as a different user than the first one.

1 Like

#5

No, not in the usual sense. Maybe you could describe the reason why you need multiple environments and what you do with them so we can provide more precise tips?

0 Likes

#6

My build environment is dependent on env-vars and many times I do multiple projects at the same time (with many terminals open).
However I just realized I can actually use sublime without this environment. I’m using EasyClangComplete package and I was under impression it needs the same env as my compiler to work properly - but it works OK without it !
So - thanks for all suggestions, all is good now !

PS. multiple processes idea might actually be a good thing for this very reason. Maybe in sublime4 ? :slight_smile:

thanks
-michal

0 Likes

#7

Because sometimes I need work with very big files, and some package I got installed is hogging Sublime Text. Then, I need quickly use a vanilla installation of Sublime Text, without disrupting my actual and active installation of Sublime Text.

On Windows, I can easily have a Sublime Text vanilla install open, and my full version opened. But on linux, it did not allowed me to do so my any means, until I read @OdatNurd tip of running the vanilla install as another second user.

After a day working on it, I got the following script. Any tips or suggestions on how to improve it are welcome:

References:

  1. https://www.shellcheck.net/#
  2. https://docs.xfce.org/xfce/thunar/custom-actions
  3. https://unix.stackexchange.com/questions/204970/clone-linux-user-copy-user-based-on-another-one
  4. https://www.howtogeek.com/50787/add-a-user-to-a-group-or-second-group-on-linux/
  5. https://stackoverflow.com/questions/14810684/check-whether-a-user-exists
  6. https://superuser.com/questions/235297/allow-specific-user-permission-to-read-write-my-folder
  7. https://askubuntu.com/questions/476641/how-can-i-get-the-name-of-the-current-terminal-from-command-line
  8. https://www.thegeekdiary.com/what-is-xhosts-how-to-use-xhost-command-to-enable-or-disable-access-control/
0 Likes

How do you run dev builds on Linux?