Fix platform detection
This commit is contained in:
parent
8c86f8ff8c
commit
a40bca29a8
1 changed files with 3 additions and 6 deletions
|
@ -17,14 +17,12 @@ import functools
|
|||
|
||||
STATUS = 0
|
||||
|
||||
|
||||
def error_unless_permitted(env_var, message):
|
||||
global STATUS
|
||||
if not os.getenv(env_var):
|
||||
sys.stderr.write(message)
|
||||
STATUS = 1
|
||||
|
||||
|
||||
def only_on(platforms):
|
||||
def decorator(func):
|
||||
@functools.wraps(func)
|
||||
|
@ -34,8 +32,7 @@ def only_on(platforms):
|
|||
return inner
|
||||
return decorator
|
||||
|
||||
|
||||
@only_on(('linux', 'darwin', 'freebsd', 'openbsd'))
|
||||
@only_on(['linux', 'darwin', 'freebsd', 'openbsd'])
|
||||
def check_rlimit_core():
|
||||
import resource
|
||||
soft, hard = resource.getrlimit(resource.RLIMIT_CORE)
|
||||
|
@ -46,9 +43,9 @@ will segfault many rustc's, creating many potentially large core files.
|
|||
set ALLOW_NONZERO_RLIMIT_CORE to ignore this warning
|
||||
""" % (soft))
|
||||
|
||||
@only_on(('windows'))
|
||||
@only_on(['win32'])
|
||||
def check_console_code_page():
|
||||
if "65001" not in subprocess.check_output(['cmd', '/c', 'chcp']):
|
||||
if '65001' not in subprocess.check_output(['cmd', '/c', 'chcp']):
|
||||
sys.stderr.write('Warning: the console output code page is not UTF-8, \
|
||||
some tests may fail. Use `cmd /c "chcp 65001"` to setup UTF-8 code page.\n')
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue