scripts/python/recordreplay.py: allow use on Windows.
Python module 'resource' is not available on Windows.
This commit is contained in:
parent
c73b1c237e
commit
f3ef077730
1 changed files with 15 additions and 7 deletions
|
@ -51,12 +51,17 @@ Args:
|
|||
'''
|
||||
|
||||
import os
|
||||
import resource
|
||||
import signal
|
||||
import subprocess
|
||||
import sys
|
||||
import time
|
||||
|
||||
try:
|
||||
import resource
|
||||
except Exception:
|
||||
# We don't mind if 'resource' module is not available, e.g. on Windows.
|
||||
resource = None
|
||||
|
||||
import FlightGear
|
||||
|
||||
def log(text):
|
||||
|
@ -141,12 +146,15 @@ class Fg:
|
|||
#
|
||||
log(f'Command is: {args}')
|
||||
log(f'Running: {args2}')
|
||||
def preexec():
|
||||
try:
|
||||
resource.setrlimit(resource.RLIMIT_CORE, (resource.RLIM_INFINITY, resource.RLIM_INFINITY))
|
||||
except Exception as e:
|
||||
log(f'*** preexec failed with e={e}')
|
||||
raise
|
||||
if resource:
|
||||
def preexec():
|
||||
try:
|
||||
resource.setrlimit(resource.RLIMIT_CORE, (resource.RLIM_INFINITY, resource.RLIM_INFINITY))
|
||||
except Exception as e:
|
||||
log(f'*** preexec failed with e={e}')
|
||||
raise
|
||||
else:
|
||||
preexec = None
|
||||
if out:
|
||||
out = open(out, 'w')
|
||||
self.child = subprocess.Popen(
|
||||
|
|
Loading…
Add table
Reference in a new issue