mirror of
https://gitea.com/gitea/act_runner.git
synced 2026-03-23 15:25:03 +01:00
auto adjust code
This commit is contained in:
@@ -161,9 +161,11 @@ func (e *Environment) exec(ctx context.Context, command []string, _ string, env
|
||||
wd = e.ToContainerPath(e.Path)
|
||||
}
|
||||
envs := ""
|
||||
var envsSb164 strings.Builder
|
||||
for k, v := range env {
|
||||
envs += shellquote.Join(k) + "=" + shellquote.Join(v) + " "
|
||||
envsSb164.WriteString(shellquote.Join(k) + "=" + shellquote.Join(v) + " ")
|
||||
}
|
||||
envs += envsSb164.String()
|
||||
return e.execRaw(ctx, "cd "+shellquote.Join(wd)+"\nenv "+envs+shellquote.Join(command...)+"\nexit $?")
|
||||
}
|
||||
|
||||
@@ -224,7 +226,7 @@ func (e *Environment) GetContainerArchive(ctx context.Context, srcPath string) (
|
||||
return e.HostEnvironment.GetContainerArchive(ctx, e.ToHostPath(srcPath))
|
||||
}
|
||||
|
||||
func (e *Environment) GetRunnerContext(ctx context.Context) map[string]interface{} {
|
||||
func (e *Environment) GetRunnerContext(ctx context.Context) map[string]any {
|
||||
rctx := e.HostEnvironment.GetRunnerContext(ctx)
|
||||
rctx["temp"] = e.ToContainerPath(e.TmpDir)
|
||||
rctx["tool_cache"] = e.ToContainerPath(e.ToolCache)
|
||||
|
||||
@@ -235,7 +235,7 @@ func ExecWithEnv(
|
||||
|
||||
func firstNonEmptyLine(outputs ...string) string {
|
||||
for _, output := range outputs {
|
||||
for _, line := range strings.Split(output, "\n") {
|
||||
for line := range strings.SplitSeq(output, "\n") {
|
||||
if line != "" {
|
||||
return line
|
||||
}
|
||||
@@ -246,5 +246,5 @@ func firstNonEmptyLine(outputs ...string) string {
|
||||
}
|
||||
|
||||
func (vm *VM) tartRunOutputPath() string {
|
||||
return filepath.Join(os.TempDir(), fmt.Sprintf("%s-tart-run-output.log", vm.id))
|
||||
return filepath.Join(os.TempDir(), vm.id+"-tart-run-output.log")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user