[gnome-builder] rls: prepend rustup path to PATH



commit 7720bec342726e44c30ab39b093778dc582aa2da
Author: Nathaniel McCallum <npmccallum redhat com>
Date:   Mon Oct 15 00:38:45 2018 -0400

    rls: prepend rustup path to PATH
    
    The existing code replaces PATH altogether. But this doesn't work when
    rustc ends up calling out to utilities like cc. The end result is that
    rls silently stops working. Instead, we will retain the existing path
    and merely add the rustup location to it. We put the rustup location
    first because this will most likely be the most up to date rust
    toolchain.
    
    Fixes: #669

 src/plugins/rust-langserv/rust_langserv_plugin.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
---
diff --git a/src/plugins/rust-langserv/rust_langserv_plugin.py 
b/src/plugins/rust-langserv/rust_langserv_plugin.py
index eb9aa81bc..b0eefaece 100644
--- a/src/plugins/rust-langserv/rust_langserv_plugin.py
+++ b/src/plugins/rust-langserv/rust_langserv_plugin.py
@@ -92,7 +92,11 @@ class RustService(Ide.Object, Ide.Service):
             # to save the user having to update PATH.
             path_to_rls = os.path.expanduser("~/.cargo/bin/rls")
             if os.path.exists(path_to_rls):
-                launcher.setenv('PATH', os.path.expanduser("~/.cargo/bin"), True)
+                old_path = os.getenv('PATH')
+                new_path = os.path.expanduser('~/.cargo/bin')
+                if old_path is not None:
+                    new_path += os.path.pathsep + old_path
+                launcher.setenv('PATH', new_path, True)
             else:
                 path_to_rls = "rls"
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]