diff --git a/cmds/cmds.ts b/cmds/cmds.ts index 33e77ff6..c862c7a6 100644 --- a/cmds/cmds.ts +++ b/cmds/cmds.ts @@ -13,10 +13,13 @@ export function deployCoreAsync(res: ts.pxtc.CompileResult) { return getBitDrivesAsync() .then(drives => { if (drives.length == 0) { - console.log("cannot find any drives to deploy to") - } else { - console.log(`copy ${ts.pxtc.BINARY_HEX} to ` + drives.join(", ")) + let msg = "cannot find any drives to deploy to"; + console.log(msg); + return Promise.reject(new Error(msg)); } + + console.log(`copy ${ts.pxtc.BINARY_HEX} to ` + drives.join(", ")) + return Promise.map(drives, d => writeFileAsync(d + ts.pxtc.BINARY_HEX, res.outfiles[ts.pxtc.BINARY_HEX]) .then(() => {