You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Looking at the doc it doesn't seem possible to add a pre exec function to the
`exec.Command` function like you could do in `subprocess.Popen` in Python [1]. Is anyone
aware of such implementation? The idea is to set there some rlimit of a process and
such.
It would be interesting to have such feature.
[1]
http://docs.python.org/2/library/subprocess.html?highlight=subprocess#subprocess.Popen
The text was updated successfully, but these errors were encountered:
Something like Python's preexec_fn (which is Unix-only even with Python) is much
harder/racier in Go. In general you can't do anything between fork and exec without
lots of care, especially in the presence of other threads.
For your case: you can exec a program to set the rlimit, and then have that program exec
the final binary.
It's possible we could add some rlimit-like stuff to exec.Cmd.SysProcAttr
(*syscall.SysProcAttr) but it seems unlikely.
I was thinking such function could be add to
http://golang.org/src/pkg/syscall/exec_linux.go#L224
and relcace SYS_EXECVE by SYS_EXECVP (the same for bsd) but right it seems simpler
doing the method you propose.
by bchesneau:
The text was updated successfully, but these errors were encountered: