Deploy no longer throws when no drives found (#269)

pxt deploy no longer throws when no drives found
This commit is contained in:
Guillaume Jenkins 2016-10-17 07:39:29 -07:00 committed by GitHub
parent 5d4bd77bf4
commit 1a3c31c9f3
1 changed files with 11 additions and 11 deletions

View File

@ -13,20 +13,20 @@ export function deployCoreAsync(res: ts.pxtc.CompileResult) {
return getBitDrivesAsync()
.then(drives => {
if (drives.length == 0) {
let msg = "cannot find any drives to deploy to";
console.log(msg);
return Promise.reject(new Error(msg));
console.log("cannot find any drives to deploy to");
return Promise.resolve(0);
}
console.log(`copy ${ts.pxtc.BINARY_HEX} to ` + drives.join(", "))
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(() => {
console.log("wrote hex file to " + d)
}))
})
.then(() => { })
let writeHexFile = (filename: string) => {
return writeFileAsync(filename + ts.pxtc.BINARY_HEX, res.outfiles[ts.pxtc.BINARY_HEX])
.then(() => console.log("wrote hex file to " + filename));
};
return Promise.map(drives, d => writeHexFile(d))
.then(() => drives.length);
});
}
function getBitDrivesAsync(): Promise<string[]> {