salopensource / sal-scripts

Apache License 2.0
23 stars 31 forks source link

curl subprocess stderr is empty string and not None #26

Closed aschwanb closed 6 years ago

aschwanb commented 6 years ago

The --silent option has been added to curl in utils.py: https://github.com/salopensource/sal-scripts/blob/master/utils.py#L83 Because of this the following stderr will always be of type string and empty:

task = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
(stdout, stderr) = task.communicate()

This leads to all if stderr is not None: statments beint evaluated as True.

I don't know if this is intended behaviour but it would be good to change the statements to something like if stderr to make the behavour more explicit.

grahamgilbert commented 6 years ago

This sounds reasonable. I would take a PR to this effect.

aschwanb commented 6 years ago

Will do. Looks like it got overlooked in this pull-request. I only found it in one place.

Pull request submitted: https://github.com/salopensource/sal-scripts/pull/27