File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -102,6 +102,15 @@ func (r *Runnable) cleanup() func() {
102
102
}
103
103
104
104
func (r * Runnable ) compute () error {
105
+ shells := map [string ]string {}
106
+ for k , v := range r .Action .Shell {
107
+ out , err := sh (context .Background (), v )
108
+ if err != nil {
109
+ return fmt .Errorf ("could not run shell script %s: %w" , k , err )
110
+ }
111
+ shells [k ] = out
112
+ }
113
+
105
114
tmpl , err := template .New ("runx" ).Funcs (template.FuncMap {
106
115
"env" : func (envName string ) string {
107
116
return r .data .Env [envName ]
@@ -110,11 +119,11 @@ func (r *Runnable) compute() error {
110
119
return r .data .Opts [optName ]
111
120
},
112
121
"sh" : func (cmdName string ) (string , error ) {
113
- cmd , ok := r . Action . Shell [cmdName ]
122
+ v , ok := shells [cmdName ]
114
123
if ! ok {
115
124
return "" , fmt .Errorf ("shell command %q not found" , cmdName )
116
125
}
117
- return sh ( context . Background (), cmd )
126
+ return v , nil
118
127
},
119
128
}).Parse (r .Action .Command )
120
129
if err != nil {
You can’t perform that action at this time.
0 commit comments