platform: modularize api/gui, add docs-tests-web foundation, and refresh root config
This commit is contained in:
29
selective-vpn-api/app/transport_netns_run.go
Normal file
29
selective-vpn-api/app/transport_netns_run.go
Normal file
@@ -0,0 +1,29 @@
|
||||
package app
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
func transportRunMust(timeout time.Duration, name string, args ...string) error {
|
||||
stdout, stderr, code, err := transportRunCommand(timeout, name, args...)
|
||||
if err != nil || code != 0 {
|
||||
return transportCommandError(name+" "+strings.Join(args, " "), stdout, stderr, code, err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func transportRunSoft(timeout time.Duration, name string, args ...string) error {
|
||||
stdout, stderr, code, err := transportRunCommand(timeout, name, args...)
|
||||
if err != nil || code != 0 {
|
||||
combined := strings.ToLower(strings.TrimSpace(stderr + " " + stdout))
|
||||
if strings.Contains(combined, "no such file") ||
|
||||
strings.Contains(combined, "not found") ||
|
||||
strings.Contains(combined, "cannot find") ||
|
||||
strings.Contains(combined, "does not exist") {
|
||||
return nil
|
||||
}
|
||||
return transportCommandError(name+" "+strings.Join(args, " "), stdout, stderr, code, err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user