Skip to content

Fix lnt startup crash on Windows #32

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions lnt/tests/nt.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@
import urllib.error
import shlex
import pipes
import resource

try:
import resource
has_resource = True
except ImportError:
has_resource = False

import click

Expand Down Expand Up @@ -73,7 +78,8 @@ def call(self, args, **kwargs):
return p.wait()

def get_time(self):
if self._user_time:
# Only get the user time if the 'resource' module is available.
if self._user_time and has_resource:
return resource.getrusage(resource.RUSAGE_CHILDREN).ru_utime
else:
return time.time()
Expand Down