Skip to content

Commit

Permalink
Inject UID env variable
Browse files Browse the repository at this point in the history
This is usually provided by bash, there might be a bunch of those we
want to add in the future (or not).
  • Loading branch information
Rafflesiaceae committed Apr 27, 2024
1 parent 25a3c2b commit 3a32108
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions nosh.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package main
import (
"fmt"
"os"
"os/user"

noshOs "github.com/Rafflesiaceae/nosh/os"

Expand Down Expand Up @@ -71,6 +72,10 @@ func run(scriptPath string, src interface{}) {
"write": fs.ModuleWrite,
}

// Injected envs
user, _ := user.Current()
os.Setenv("UID", user.Uid) // @TODO move to os/user.go

thread := &starlark.Thread{
Name: "nosh",
Print: func(thread *starlark.Thread, msg string) {
Expand Down

0 comments on commit 3a32108

Please sign in to comment.