jezdez / envdir

A Python port of daemontools' envdir.
https://envdir.readthedocs.io/
MIT License
229 stars 28 forks source link

check if envdir is a directory #6

Closed quiver closed 11 years ago

quiver commented 11 years ago

If a file path was specified as envdir directory, py-envdir tried to read env files from 'filepath/*'. Since glob does not care if these paths exist or not, instead of raising error, glob just returns [] and no environment variables are overwritten.

On djb's original implementation, envdir raises 111 error for such case.

djb envdir's behavior::

  $ /usr/bin/envdir /etc/hostname ls
  envdir: fatal: unable to switch to directory /etc/hostname: not a directory
  $ echo $?
  111

Changed py-envdir to bahave just like djs envdir.

jezdez commented 11 years ago

Sweet! Thanks again :)