10000 Moving parsing of fs_cat to core lib · arduino/micropython.js@ed0ddab · GitHub
[go: up one dir, main page]

Skip to content

Commit ed0ddab

Browse files
committed
Moving parsing of fs_cat to core lib
1 parent 8b0a4a0 commit ed0ddab

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

cli.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,7 @@ const getFile = (args, port) => {
124124
.then(async () => {
125125
try {
126126
let output = await board.fs_cat(boardFilename)
127-
output = output.split('raw REPL; CTRL-B to exit\r\n>OK')
128-
const content = output[1].slice(0, -1)
129-
fs.writeFileSync(diskFilename, content)
127+
fs.writeFileSync(diskFilename, output)
130128
} catch(e) {
131129
console.log('error', e)
132130
}

micropython.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,9 @@ class MicroPythonBoard {
235235
command: `with open('${filePath}', 'r') as f:\n while 1:\n b=f.read(256)\n if not b:break\n print(b,end='')`
236236
})
237237
await this.exit_raw_repl()
238-
return Promise.resolve(output)
238+
const outputArray = output.split('raw REPL; CTRL-B to exit\r\n>OK')
239+
const content = outputArray[1].slice(0, -1)
240+
return Promise.resolve(content)
239241
}
240242
return Promise.reject(new Error(`Path to file was not specified`))
241243
}

0 commit comments

Comments
 (0)
0