@@ -241,7 +241,7 @@ func (s *Shell) execPOSIX(ctx context.Context, command string) (string, string,
241241 interp.Interactive(false),
242242 interp.Env(expand.ListEnviron(s.env...)),
243243 interp.Dir(s.cwd),
244− interp.ExecHandlers(s.blockHandler(), coreutils.ExecHandler),
244+ interp.ExecHandlers(s.execHandlers()...),
245245 )
246246 if err != nil {
247247 return "", "", fmt.Errorf("could not run command: %w", err)
@@ -257,6 +257,16 @@ func (s *Shell) execPOSIX(ctx context.Context, command string) (string, string,
257257 return stdout.String(), stderr.String(), err
258258}
259259
260+func (s *Shell) execHandlers() []func(next interp.ExecHandlerFunc) interp.ExecHandlerFunc {
261+ handlers := []func(next interp.ExecHandlerFunc) interp.ExecHandlerFunc{
262+ s.blockHandler(),
263+ }
264+ if useGoCoreUtils {
265+ handlers = append(handlers, coreutils.ExecHandler)
266+ }
267+ return handlers
268+}
269+
260270// IsInterrupt checks if an error is due to interruption
261271func IsInterrupt(err error) bool {
262272 return errors.Is(err, context.Canceled) ||