@@ -134,13 +134,16 @@ with open("${path}", "rb") as f:
134134 byte_string = f.read()
135135 print(binascii.b2a_base64(byte_string, False))
136136` ;
137+
137138 let result = await this . _repl . runCode ( code ) ;
138- if ( this . _checkReplErrors ( ) ) {
139+ if ( await this . _checkReplErrors ( ) ) {
139140 return null ;
140141 }
141142
142143 // strip the b, ending newline, and quotes from the beginning and end
143- result = result . slice ( 2 , - 3 ) ;
144+ let sliceStart = result . indexOf ( "b'" ) + 2 ;
145+ let sliceEnd = result . lastIndexOf ( "'" ) ;
146+ result = result . slice ( sliceStart , sliceEnd ) ;
144147
145148 // convert the base64 string to an ArrayBuffer. Each byte of the Array buffer is a byte of the file with a value between 0-255
146149 result = atob ( result ) ; // Convert base64 to binary string
@@ -249,7 +252,7 @@ os.mkdir("${path}")
249252 code += `os.utime("${ path } ", (${ modificationTime } , ${ modificationTime } ))\n` ;
250253 }
251254 await this . _repl . runCode ( code ) ;
252- this . _checkReplErrors ( ) ;
255+ await this . _checkReplErrors ( ) ;
253256 }
254257
255258 async delete ( path ) {
@@ -263,7 +266,7 @@ else:
263266 os.rmdir("${ path } ")
264267` ;
265268 await this . _repl . runCode ( code ) ;
266- this . _checkReplErrors ( ) ;
269+ await this . _checkReplErrors ( ) ;
267270 }
268271
269272 async move ( oldPath , newPath ) {
@@ -276,7 +279,7 @@ import os
276279os.rename("${ oldPath } ", "${ newPath } ")
277280` ;
278281 await this . _repl . runCode ( code ) ;
279- let error = this . _checkReplErrors ( ) ;
282+ let error = await this . _checkReplErrors ( ) ;
280283
281284 return ! error ;
282285 }
0 commit comments