Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ynh_print_OFF when set -x is used in other helpers #733

merged 1 commit into from Jun 7, 2019


None yet
3 participants
Copy link

commented Jun 1, 2019

The problem

As reported by @Josue-T, ynh_print_OFF doesn't work when used before a helper using getopts, because the helper getopts use set -x.


Redirect BASH_XTRACEFD, the file descriptor for xtrace, to /dev/null to get rid of the trace.
Then redirect back to stdout.

PR Status

Tested on leed.

How to test



  • Principle agreement 0/2 :
  • Quick review 0/1 :
  • Simple test 0/1 :
  • Deep review 0/1 :


Copy link

left a comment

Uh wokay, looks like black magic but trusting you I guess ? :D

@alexAubin alexAubin added this to the 3.6.x milestone Jun 3, 2019


This comment has been minimized.

Copy link
Contributor Author

commented Jun 3, 2019

Not really black magic, just using BASH_XTRACEFD, which contains the file descriptor (usually 7) and redirect it to /dev/null instead of stdout.
You can see that when using --debug, the command line contains BASH_XTRACEFD=7 [...] 7>&1'


This comment has been minimized.

Copy link

commented Jun 3, 2019

cmd = 'BASH_XTRACEFD=7 /bin/bash -x "{script}" {args} 7>&1'

@alexAubin alexAubin merged commit e935263 into stretch-unstable Jun 7, 2019

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
continuous-integration/travis-ci/push The Travis CI build passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.