Skip to content

Commit c54644a

Browse files
committed
fix: fix fetchDependency method
1 parent 0b79437 commit c54644a

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

server/app.ts

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1257,24 +1257,27 @@ export class Application {
12571257
}
12581258

12591259
try {
1260-
log.info('Download', url)
12611260
const p = Deno.run({
12621261
cmd: [Deno.execPath(), 'cache', reload ? '--reload' : '', u.toString()],
1263-
stdout: 'null',
1264-
stderr: 'null'
1262+
stdout: 'inherit',
1263+
stderr: 'piped'
12651264
})
1265+
await Deno.stderr.write(await p.stderrOutput())
12661266
await p.status()
12671267
p.close()
12681268
if (existsFileSync(cacheFilename)) {
12691269
return await Deno.readFile(cacheFilename)
12701270
}
1271-
} catch (e) {
1272-
log.warn(e)
1273-
}
1271+
} catch (e) { }
12741272

12751273
// download dep when deno cache failed
1276-
log.info('Force download from', url)
1277-
const buffer = await fetch(u.toString()).then(resp => resp.arrayBuffer())
1274+
console.log(colors.green('Force download'), url)
1275+
const buffer = await fetch(u.toString()).then(resp => {
1276+
if (resp.status !== 200) {
1277+
return Promise.reject(new Error(resp.statusText))
1278+
}
1279+
return resp.arrayBuffer()
1280+
})
12781281
return await Deno.readAll(new Deno.Buffer(buffer))
12791282
}
12801283

0 commit comments

Comments
 (0)