Skip to content
Snippets Groups Projects
Commit 1ac75935 authored by Piotr Maślanka's avatar Piotr Maślanka
Browse files

fix

parent cadba6ee
No related branches found
No related tags found
No related merge requests found
...@@ -25,6 +25,9 @@ local.properties ...@@ -25,6 +25,9 @@ local.properties
# Locally stored "Eclipse launch configurations" # Locally stored "Eclipse launch configurations"
*.launch *.launch
.vagrant/ .vagrant/
docs/_build/
docs/_static/
docs/_templates
# CDT-specific # CDT-specific
.cproject .cproject
......
...@@ -5,7 +5,7 @@ How to do common things. ...@@ -5,7 +5,7 @@ How to do common things.
## Check if running as root ## Check if running as root
```python ```python
from satella import is_running_as_root from satella.unix import is_running_as_root
if is_running_as_root(): if is_running_as_root():
print('Root!') print('Root!')
else: else:
...@@ -19,7 +19,7 @@ Use a context manager, _AcquirePIDLock_ from module _satella.pid_. Example: ...@@ -19,7 +19,7 @@ Use a context manager, _AcquirePIDLock_ from module _satella.pid_. Example:
Example: Example:
```python ```python
from satella.pidlock import AcquirePIDLock from satella.unix import AcquirePIDLock
with AcquirePIDLock('satella.pid'): with AcquirePIDLock('satella.pid'):
print('Lock is acquired!') print('Lock is acquired!')
......
import os
def is_running_as_root():
"""
Is this process running as root?
Checks whether EUID is 0
:return: bool
"""
return os.geteuid() == 0
...@@ -5,7 +5,20 @@ UNIX things ...@@ -5,7 +5,20 @@ UNIX things
from __future__ import print_function, absolute_import, division from __future__ import print_function, absolute_import, division
import six import six
import logging import logging
import os
from satella.unix.daemon import daemonize from satella.unix.daemon import daemonize
from satella.unix.pidlock import AcquirePIDLock from satella.unix.pidlock import AcquirePIDLock
__all__ = ('daemonize', 'AcquirePIDLock', 'is_running_as_root')
def is_running_as_root():
"""
Is this process running as root?
Checks whether EUID is 0
:return: bool
"""
return os.geteuid() == 0
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment