File tree Expand file tree Collapse file tree 2 files changed +5
-4
lines changed
Expand file tree Collapse file tree 2 files changed +5
-4
lines changed Original file line number Diff line number Diff line change 11[project ]
22authors = [{
name =
" Aman Rusia" ,
email =
" [email protected] " }]
33name = " wcgw"
4- version = " 0.1.1 "
4+ version = " 0.1.2 "
55description = " What could go wrong giving full shell access to chatgpt?"
66readme = " README.md"
77requires-python = " >=3.10, <3.13"
Original file line number Diff line number Diff line change @@ -114,7 +114,8 @@ def _get_exit_code() -> int:
114114 while not _is_int (before ): # Consume all previous output
115115 SHELL .expect ("#@@" )
116116 assert isinstance (SHELL .before , str )
117- before = SHELL .before
117+ # Render because there could be some anscii escape sequences still set like in google colab env
118+ before = render_terminal_output (SHELL .before ).strip ()
118119
119120 try :
120121 return int ((before ))
@@ -285,7 +286,7 @@ def read_image_from_shell(file_path: str) -> ImageData:
285286 SHELL .sendline ("pwd" )
286287 SHELL .expect ("#@@" )
287288 assert isinstance (SHELL .before , str )
288- current_dir = SHELL .before .strip ()
289+ current_dir = render_terminal_output ( SHELL .before ) .strip ()
289290 file_path = os .path .join (current_dir , file_path )
290291
291292 if not os .path .exists (file_path ):
@@ -304,7 +305,7 @@ def write_file(writefile: Writefile) -> str:
304305 SHELL .sendline ("pwd" )
305306 SHELL .expect ("#@@" )
306307 assert isinstance (SHELL .before , str )
307- current_dir = SHELL .before .strip ()
308+ current_dir = render_terminal_output ( SHELL .before ) .strip ()
308309 return f"Failure: Use absolute path only. FYI current working directory is '{ current_dir } '"
309310 os .makedirs (os .path .dirname (writefile .file_path ), exist_ok = True )
310311 try :
You can’t perform that action at this time.
0 commit comments