Skip to content

Commit

Permalink
Make sure r2lang and r2 are in sync
Browse files Browse the repository at this point in the history
  • Loading branch information
dnakov authored and trufae committed Oct 21, 2024
1 parent 9b48224 commit f0f8aee
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions r2ai/pipe.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def cmd(self, x):
try:
import r2lang
have_rlang = True
except Exception as e:
except Exception:
import r2pipe
try:
if r2pipe.in_r2():
Expand All @@ -48,7 +48,8 @@ def cmd(self, x):
if os.environ.get('R2AI') is None:
ppid = os.getppid()
os.environ["R2AI"] = "1"
r2lang = FakeLang(r2pipe.open("/bin/ls"))
filename = "/bin/ls"
r2lang = FakeLang(r2pipe.open(filename))
else:
r2lang = FakeLang(None)
except Exception:
Expand All @@ -64,10 +65,11 @@ def get_r2_inst():

@progress_bar("Loading", color="yellow")
def open_r2(file, flags=[]):
global r2, filename
global r2, filename, r2lang
r2 = r2pipe.open(file, flags=flags)
r2lang = FakeLang(r2)
filename = file
return r2
return r2lang

def get_filename():
global filename
Expand Down

0 comments on commit f0f8aee

Please sign in to comment.