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 os
|
||||||
import resource
|
|
||||||
import signal
|
import signal
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
import time
|
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
|
import FlightGear
|
||||||
|
|
||||||
def log(text):
|
def log(text):
|
||||||
|
@ -141,12 +146,15 @@ class Fg:
|
||||||
#
|
#
|
||||||
log(f'Command is: {args}')
|
log(f'Command is: {args}')
|
||||||
log(f'Running: {args2}')
|
log(f'Running: {args2}')
|
||||||
def preexec():
|
if resource:
|
||||||
try:
|
def preexec():
|
||||||
resource.setrlimit(resource.RLIMIT_CORE, (resource.RLIM_INFINITY, resource.RLIM_INFINITY))
|
try:
|
||||||
except Exception as e:
|
resource.setrlimit(resource.RLIMIT_CORE, (resource.RLIM_INFINITY, resource.RLIM_INFINITY))
|
||||||
log(f'*** preexec failed with e={e}')
|
except Exception as e:
|
||||||
raise
|
log(f'*** preexec failed with e={e}')
|
||||||
|
raise
|
||||||
|
else:
|
||||||
|
preexec = None
|
||||||
if out:
|
if out:
|
||||||
out = open(out, 'w')
|
out = open(out, 'w')
|
||||||
self.child = subprocess.Popen(
|
self.child = subprocess.Popen(
|
||||||
|
|
Loading…
Add table
Reference in a new issue