jenkinsci / jenkinsci/workflow-durable-task-step-plugin

[JENKINS-57149] Shell redirect causes exit code 0

Open
#574 0 comments 0 reactions 0 assignees View on GitHub
component:workflow-durable-task-step-plugin imported-jira-issue priority:minor resolution:unresolved
Dominant language
Java
Stars
46
Forks
110
PR merge metrics
No merged PRs in 30d

Description

Running a `sh()` step that has `&>` or any redirect causes the command to work even if the command should fail. It also doesn't appear that the command is running at all. 

So `sh('FakeNews &> test.log')` outputs the `command not found` error to the console instead of the file. Creates an empty `test.log` and the build passes even though it should have failed. But `sh('FakeNews')` causes exception FakeNews: command not found. This is a more recent issue (last 4 months or so) didn't see this before that.

I had originally created this bug as a docker issue but I'm seeing it on our updated AWS instances as well.

---
Originally reported by shadycuz, imported from: Shell redirect causes exit code 0


  • status: Open
  • priority: Minor
  • component(s): workflow-durable-task-step-plugin
  • resolution: Unresolved
  • votes: 1
  • watchers: 2
  • imported: 20251212-090250

Raw content of original issue

Running a `sh()` step that has `&>` or any redirect causes the command to work even if the command should fail. It also doesn't appear that the command is running at all. 

So `sh('FakeNews &> test.log')` outputs the `command not found` error to the console instead of the file. Creates an empty `test.log` and the build passes even though it should have failed. But `sh('FakeNews')` causes exception FakeNews: command not found. This is a more recent issue (last 4 months or so) didn't see this before that.

I had originally created this bug as a docker issue but I'm seeing it on our updated AWS instances as well.

  • environment: Plugin v2.21 and 2.30. Also tested this on several Jenkins of various versions.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.