@@ -12,7 +12,6 @@ import (
12
12
"runtime"
13
13
"strings"
14
14
15
- "code.gitea.io/gitea/modules/graceful"
16
15
"code.gitea.io/gitea/modules/log"
17
16
"code.gitea.io/gitea/modules/markup"
18
17
"code.gitea.io/gitea/modules/process"
@@ -80,8 +79,8 @@ func envMark(envName string) string {
80
79
func (p * Renderer ) Render (ctx * markup.RenderContext , input io.Reader , output io.Writer ) error {
81
80
var (
82
81
command = strings .NewReplacer (
83
- envMark ("GITEA_PREFIX_SRC" ), ctx .Links .SrcLink (),
84
- envMark ("GITEA_PREFIX_RAW" ), ctx .Links .RawLink (),
82
+ envMark ("GITEA_PREFIX_SRC" ), ctx .RenderOptions . Links .SrcLink (),
83
+ envMark ("GITEA_PREFIX_RAW" ), ctx .RenderOptions . Links .RawLink (),
85
84
).Replace (p .Command )
86
85
commands = strings .Fields (command )
87
86
args = commands [1 :]
@@ -113,22 +112,14 @@ func (p *Renderer) Render(ctx *markup.RenderContext, input io.Reader, output io.
113
112
args = append (args , f .Name ())
114
113
}
115
114
116
- if ctx .Ctx == nil {
117
- if ! setting .IsProd || setting .IsInTesting {
118
- panic ("RenderContext did not provide context" )
119
- }
120
- log .Warn ("RenderContext did not provide context, defaulting to Shutdown context" )
121
- ctx .Ctx = graceful .GetManager ().ShutdownContext ()
122
- }
123
-
124
- processCtx , _ , finished := process .GetManager ().AddContext (ctx .Ctx , fmt .Sprintf ("Render [%s] for %s" , commands [0 ], ctx .Links .SrcLink ()))
115
+ processCtx , _ , finished := process .GetManager ().AddContext (ctx , fmt .Sprintf ("Render [%s] for %s" , commands [0 ], ctx .RenderOptions .Links .SrcLink ()))
125
116
defer finished ()
126
117
127
118
cmd := exec .CommandContext (processCtx , commands [0 ], args ... )
128
119
cmd .Env = append (
129
120
os .Environ (),
130
- "GITEA_PREFIX_SRC=" + ctx .Links .SrcLink (),
131
- "GITEA_PREFIX_RAW=" + ctx .Links .RawLink (),
121
+ "GITEA_PREFIX_SRC=" + ctx .RenderOptions . Links .SrcLink (),
122
+ "GITEA_PREFIX_RAW=" + ctx .RenderOptions . Links .RawLink (),
132
123
)
133
124
if ! p .IsInputFile {
134
125
cmd .Stdin = input
0 commit comments