-
Notifications
You must be signed in to change notification settings - Fork 847
Closed
Description
When using #r "nuget: .....", FSI appends a string to the PATH environment variable:
PATH=/usr/local/sbin:/xxxxxxx;/homepath/.nuget/packages/package/x.x.x/;
It uses the ; character as a separator, however in Linux : is the PATH env var separator.
Surprisingly, some distributions are tolerant of this (Ubuntu), others however are not (Alpine).
This has all sort of weird side effects in the FSI process/script that is running, especially if you try launch a sub process.
Repro steps
#r "nuget: Newtonsoft.Json"
System.Environment.GetEnvironmentVariables()
|> Seq.cast<System.Collections.DictionaryEntry>
|> Seq.filter (fun x -> x.Key |> string = "PATH")
|> Seq.iter (fun x -> printfn "%s:%s" (string x.Key) (string x.Value))
Expected behavior
FSI appends to PATH with the platform specific separator.
Actual behavior
PATH gets butchered.
Known workarounds
#r "nuget: Newtonsoft.Json"
// 😥
let fixedPathEnv = System.Environment.GetEnvironmentVariable("PATH").Replace(';', ':').TrimEnd(':')
System.Environment.SetEnvironmentVariable("PATH", fixedPathEnv)
System.Environment.GetEnvironmentVariables()
|> Seq.cast<System.Collections.DictionaryEntry>
|> Seq.filter (fun x -> x.Key |> string = "PATH")
|> Seq.iter (fun x -> printfn "%s:%s" (string x.Key) (string x.Value))
Metadata
Metadata
Assignees
Labels
No labels