MCPcopy Index your code
hub / github.com/keploy/keploy / GetFullCommandUsed

Function GetFullCommandUsed

utils/utils.go:1683–1700  ·  view source on GitHub ↗

GetFullCommandUsed returns the full command-line used to run the current process. It reconstructs the command from os.Args, adding quoting for arguments with spaces or quotes.

()

Source from the content-addressed store, hash-verified

1681// GetFullCommandUsed returns the full command-line used to run the current process.
1682// It reconstructs the command from os.Args, adding quoting for arguments with spaces or quotes.
1683func GetFullCommandUsed() string {
1684 args := os.Args
1685
1686 // Build the command string with proper quoting for arguments containing spaces
1687 var parts []string
1688 for _, arg := range args {
1689 if strings.Contains(arg, " ") || strings.Contains(arg, "\"") {
1690 // Quote the argument if it contains spaces or quotes
1691 parts = append(parts, fmt.Sprintf("%q", arg))
1692 } else {
1693 parts = append(parts, arg)
1694 }
1695 }
1696
1697 cmdStr := strings.Join(parts, " ")
1698
1699 return cmdStr
1700}

Callers 1

startFunction · 0.92

Calls

no outgoing calls

Tested by

no test coverage detected