Skip to content

Commit

Permalink
passed all ENV vars when executing the user command
Browse files Browse the repository at this point in the history
  • Loading branch information
fabpot committed Jan 30, 2017
1 parent 49ce8ff commit 0a1c75e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func execCmd(path string, req request) result {
cmd.Dir = path
cmd.Stdout = &r.stdout
cmd.Stderr = &r.stderr
cmd.Env = []string{fmt.Sprintf("HOME=%s", os.Getenv("HOME"))}
cmd.Env = os.Environ()
if err := cmd.Start(); err != nil {
fmt.Println(err)
os.Exit(1)
Expand Down Expand Up @@ -138,7 +138,7 @@ func (r *result) sendEmail() {
for _, email := range emails {
cmd := exec.Command(transportPath, "-s", r.subject(), strings.TrimSpace(email))
cmd.Stdin = r.render()
cmd.Env = []string{fmt.Sprintf("HOME=%s", os.Getenv("HOME"))}
cmd.Env = os.Environ()
if err := cmd.Run(); err != nil {
fmt.Printf("Could not send email to %s: %s\n", email, err)
os.Exit(1)
Expand All @@ -151,7 +151,7 @@ func (r *result) sendEmail() {
message := fmt.Sprintf("To: %s\r\nCc: %s\r\nSubject: %s\r\n\r\n%s", emails[0], strings.Join(emails[1:], ","), r.subject(), r.render().String())
cmd := exec.Command(transportPath, "-t")
cmd.Stdin = strings.NewReader(message)
cmd.Env = []string{fmt.Sprintf("HOME=%s", os.Getenv("HOME"))}
cmd.Env = os.Environ()
if err := cmd.Run(); err != nil {
fmt.Printf("Could not send email to %s: %s\n", emails, err)
os.Exit(1)
Expand Down

0 comments on commit 0a1c75e

Please sign in to comment.