Skip to content

Commit

Permalink
refactor: replace OSError aliases (#769)
Browse files Browse the repository at this point in the history
  • Loading branch information
theguy147 authored Dec 16, 2021
1 parent a7ab48e commit f497bc8
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions gef.py
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ def inner_f(*args, **kwargs):
f(*args, **kwargs)
else:
reason = "GDB >= {} for this command".format(required_gdb_version)
raise EnvironmentError(reason)
raise OSError(reason)
return inner_f
return wrapper

Expand All @@ -406,7 +406,7 @@ def inner_f(*args, **kwargs):
f(*args, **kwargs)
else:
reason = "This command cannot work for the '{}' architecture".format(gef.arch.arch)
raise EnvironmentError(reason)
raise OSError(reason)
return inner_f
return wrapper

Expand Down Expand Up @@ -2098,7 +2098,7 @@ def endianness(self) -> Endianness:
elif "big endian" in output:
self.__endianness = Endianness.BIG_ENDIAN
else:
raise EnvironmentError(f"No valid endianess found in '{output}'")
raise OSError(f"No valid endianess found in '{output}'")
return self.__endianness

def get_ith_parameter(self, i, in_func=True):
Expand Down Expand Up @@ -3156,7 +3156,7 @@ def open_file(path, use_cache=False):
if is_remote_debug() and not __gef_qemu_mode__:
lpath = download_file(path, use_cache)
if not lpath:
raise IOError("cannot open remote path {:s}".format(path))
raise OSError("cannot open remote path {:s}".format(path))
path = lpath

return open(path, "r")
Expand Down Expand Up @@ -3744,7 +3744,7 @@ def get_memory_alignment(in_bits=False):
except:
pass

raise EnvironmentError("GEF is running under an unsupported mode")
raise OSError("GEF is running under an unsupported mode")


def clear_screen(tty=""):
Expand Down Expand Up @@ -5658,7 +5658,7 @@ def is_target_alive(self, host, port):
s.settimeout(1)
s.connect((host, port))
s.close()
except socket.error:
except OSError:
return False
return True

Expand Down Expand Up @@ -5751,7 +5751,7 @@ def parsed_arglist(arglist):
jump = getattr(self.sock, "jump")
jump(hex(gef.arch.pc-main_base_address),)

except socket.error:
except OSError:
self.disconnect()
return

Expand Down Expand Up @@ -9966,7 +9966,7 @@ def do_invoke(self, argv):

try:
readelf = gef.session.constants["readelf"]
except IOError:
except OSError:
err("Missing `readelf`")
return

Expand Down

0 comments on commit f497bc8

Please sign in to comment.