mirror of
https://github.com/R0m1k3/Loki.git
synced 2026-10-18 12:46:56 +02:00
Correction Windows
This commit is contained in:
1 parent
a40c50c400
commit
ca0a315260
14 files changed
+973
-87
No files matched your search
@@ -35,9 +35,10 @@ func setToolsEnabled(on bool) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// runShell executes a command via `bash -c` with a clamped timeout, returning
|
||||
// a single string formatted "exit: N\n\nstdout:\n...\n\nstderr:\n..." truncated
|
||||
// to keep tool output bounded.
|
||||
// runShell executes a command via the platform shell (bash -c on Unix, cmd /C
|
||||
// on Windows — see newShellCmd in platform_*.go) with a clamped timeout,
|
||||
// returning a single string formatted "exit: N\n\nstdout:\n...\n\nstderr:\n..."
|
||||
// truncated to keep tool output bounded.
|
||||
func runShell(command string, timeoutSec int) string {
|
||||
if timeoutSec <= 0 {
|
||||
timeoutSec = toolDefaultTimeout
|
||||
@@ -47,7 +48,7 @@ func runShell(command string, timeoutSec int) string {
|
||||
}
|
||||
ctx, cancel := context.WithTimeout(context.Background(), time.Duration(timeoutSec)*time.Second)
|
||||
defer cancel()
|
||||
cmd := exec.CommandContext(ctx, "/bin/bash", "-c", command)
|
||||
cmd := newShellCmd(ctx, command)
|
||||
var stdout, stderr strings.Builder
|
||||
cmd.Stdout = &stdout
|
||||
cmd.Stderr = &stderr
|
||||
|
||||
Reference in new issue
Block a user