@@ -134,13 +134,16 @@ with open("${path}", "rb") as f:
134
134
byte_string = f.read()
135
135
print(binascii.b2a_base64(byte_string, False))
136
136
` ;
137
+
137
138
let result = await this . _repl . runCode ( code ) ;
138
- if ( this . _checkReplErrors ( ) ) {
139
+ if ( await this . _checkReplErrors ( ) ) {
139
140
return null ;
140
141
}
141
142
142
143
// 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 ) ;
144
147
145
148
// 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
146
149
result = atob ( result ) ; // Convert base64 to binary string
@@ -249,7 +252,7 @@ os.mkdir("${path}")
249
252
code += `os.utime("${ path } ", (${ modificationTime } , ${ modificationTime } ))\n` ;
250
253
}
251
254
await this . _repl . runCode ( code ) ;
252
- this . _checkReplErrors ( ) ;
255
+ await this . _checkReplErrors ( ) ;
253
256
}
254
257
255
258
async delete ( path ) {
@@ -263,7 +266,7 @@ else:
263
266
os.rmdir("${ path } ")
264
267
` ;
265
268
await this . _repl . runCode ( code ) ;
266
- this . _checkReplErrors ( ) ;
269
+ await this . _checkReplErrors ( ) ;
267
270
}
268
271
269
272
async move ( oldPath , newPath ) {
@@ -276,7 +279,7 @@ import os
276
279
os.rename("${ oldPath } ", "${ newPath } ")
277
280
` ;
278
281
await this . _repl . runCode ( code ) ;
279
- let error = this . _checkReplErrors ( ) ;
282
+ let error = await this . _checkReplErrors ( ) ;
280
283
281
284
return ! error ;
282
285
}
0 commit comments