Golang os.Exit() return control back to called process

67 views Asked by At

In dovecot post-login script, i am trying to use go build as the script to check some user information stored in database. dovecot, post-login

Post-login script failure we can return exit code 1,127.... etc standard return code. if the success is return to the process with control back suppose if we use bash script successful is exec $@

exec "$@"

$@ contains --> /usr/lib/dovecot/script-login i need to do the same in go-lang program also in go-lang we can return exit code which is integer and i tried to do that it's failing any one please help me out on this, how can i achieve this... your reply is price less for me.

In go-lang i expect as bash

exec "$@"

same should be return in go-lang also.

Example in bash script

#!/bin/sh

export MAIL=maildir:/tmp/test
export USERDB_KEYS="$USERDB_KEYS mail"
exec "$@"

need to do the same in go lang

package main

import (
    "os"
    "fmt"       
)
func main() {
    username := os.Getenv("USER")
    ip := os.Getenv("IP")
    fmt.Print("Username : %s and IP address : %s", username, ip)
    // Need to do exec $@
}

can you please help me on this

0

There are 0 answers