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

Strict mode bash #71

Open
ghost opened this issue Jul 6, 2016 · 3 comments
Open

Strict mode bash #71

ghost opened this issue Jul 6, 2016 · 3 comments
Labels

Comments

@ghost
Copy link

ghost commented Jul 6, 2016

Hi.

I was hoping to use resty in a REST API test suite written in bash, but I'm finding it's not set up to be run with set -u (nounset) (at least).

Steps to repeat:

#!/bin/bash

set -o errtrace
set -o functrace
set -o pipefail
set -o nounset
source "${RESTY}" -W "${API_BASE_URI}"

GET /

If I put the set -o nounset before the source, then the resty command at the end of the source file fails (e.g. resty http://localhost). If I put the set -o nounset after source but before the GET line, I get:

+ resty GET /
+ local confdir datadir host cookies method h2t editor domain _path opt dat res ret out err verbose raw i j d tmpf args2 wantdata vimedit quote query maybe_query dry
+ local -a curlopt
+ local -a curlopt2
/home/vagrant/repos/resty/resty: line 21: XDG_CONFIG_HOME: unbound variable

Thoughts?

@AdrieanKhisbe
Copy link
Collaborator

Hey @josdotso, sorry for the late answer

the failure is normal. The resty command loock if XDG_CONFIG_HOME is set to something. Since it's not, the set -u will cause failure you are having.

@AdrieanKhisbe
Copy link
Collaborator

@josdotso
Anything else?
Shall i close the issue?

@jtojnar
Copy link

jtojnar commented Jan 5, 2018

Since resty is expected to be run sourced, it would be nice if it could run in a “strict mode”. You can use ${XDG_CONFIG_HOME:-} syntax to make it work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants