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

PR: Fix test_shell_execution for macOS #20548

Merged
merged 1 commit into from
Feb 17, 2023

Conversation

mrclary
Copy link
Contributor

@mrclary mrclary commented Feb 17, 2023

zsh does not have the -u shell option. macOS can use bash instead of zsh.

Correct execution (via bash) looks like this:

(spy-dev) >> /bin/bash spyder/app/tests/bash_example.sh $(pwd)
allexport      	off
braceexpand    	on
emacs          	off
errexit        	on
errtrace       	off
functrace      	off
hashall        	on
histexpand     	off
history        	off
ignoreeof      	off
interactive-comments	on
keyword        	off
monitor        	off
noclobber      	off
noexec         	off
noglob         	off
nolog          	off
notify         	off
nounset        	off
onecmd         	off
physical       	off
pipefail       	off
posix          	off
privileged     	off
verbose        	off
vi             	off
xtrace         	on
+ TEMP_DIR=/Users/rclary/Documents/Repos/Spyder-IDE/spyder
++ uname
+ echo 'This is a temporary file created by Darwin'

The error from zsh is:

(spy-dev) >> /bin/zsh spyder/app/tests/bash_example.sh $(pwd)
spyder/app/tests/bash_example.sh:set:1: no such option: u

Since zsh is the default macOS shell, -u is removed from bash_example.sh

@mrclary
Copy link
Contributor Author

mrclary commented Feb 17, 2023

@ccordoba12,
Alternatively, the -u option can be removed from bash_example.sh.

https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html

-u
Treat unset variables and parameters other than the special parameters ‘@’ or ‘’, or array variables subscripted with ‘@’ or ‘’, as an error when performing parameter expansion. An error message will be written to the standard error, and a non-interactive shell will exit.

I don't think it is necessary in our case since we do not perform any parameter expansion on unset variables.
Indeed, I don't know that the set command or any of the options are necessary for this test.

@ccordoba12
Copy link
Member

Alternatively, the -u option can be removed from bash_example.sh

Ok, please do that instead because we should try to run the test with zsh since it's the default shell on Mac.

zsh does not have -u shell option. macOS can use bash instead of zsh, alternatively, -u option can be removed from bash_example.sh.
Copy link
Member

@ccordoba12 ccordoba12 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @mrclary!

@ccordoba12 ccordoba12 merged commit 6154bc7 into spyder-ide:master Feb 17, 2023
@mrclary mrclary deleted the fix-shell-test branch April 16, 2023 23:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants