-
Notifications
You must be signed in to change notification settings - Fork 208
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: resolve floating-promise warnings in kernel packages #8214
Changes from all commits
bf0fdcc
a521a9a
e5adec5
39b9323
6439256
f5fb0ce
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -152,7 +152,7 @@ export async function xsnap(options) { | |
sourceStream.pipe(destStream, { end: false }); | ||
|
||
done = finished(sourceStream); | ||
done.catch(noop).then(() => sourceStream.unpipe(destStream)); | ||
void done.catch(noop).then(() => sourceStream.unpipe(destStream)); | ||
}; | ||
|
||
return harden({ | ||
|
@@ -258,7 +258,7 @@ export async function xsnap(options) { | |
await loadSnapshotHandler?.afterSpawn(snapshotLoadStream); | ||
|
||
if (loadSnapshotHandler) { | ||
vatExit.promise.catch(noop).then(() => { | ||
void vatExit.promise.catch(noop).then(() => { | ||
if (loadSnapshotHandler) { | ||
const { cleanup } = loadSnapshotHandler; | ||
loadSnapshotHandler = undefined; | ||
|
@@ -458,10 +458,13 @@ export async function xsnap(options) { | |
const handle = await fs.open(snapPath, 'w+'); | ||
// @ts-expect-error 'close' event added in Node 15.4 | ||
handle.on('close', () => { | ||
fs.unlink(snapPath); | ||
// Safe to ignore the result because we are skipping to to clean up the temp directory. | ||
void fs.unlink(snapPath); | ||
}); | ||
sourceStream = handle.createReadStream(); | ||
finished(output).finally(() => sourceStream.destroy()); | ||
finished(output) | ||
.finally(() => sourceStream.destroy()) | ||
.catch(noop); | ||
} else { | ||
sourceStream = snapshotSaveStream; | ||
snapPath = `@${SNAPSHOT_SAVE_FD}`; | ||
|
@@ -470,7 +473,7 @@ export async function xsnap(options) { | |
// ensuring that any previous save stream usage has ended. However we | ||
// must start the flow before receiving the command's response or the | ||
// xsnap process would block on a full pipe, causing an IPC deadlock. | ||
batonKit.promise.then(maybePipe); | ||
batonKit.promise.then(maybePipe, noop); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. maybe the same issue here? I definitely want @mhofman to drive this part, I don't understand the whole "baton" thing very well There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This one is valid, it silences a potential rejection of the baton that would bottom out somewhere else. |
||
} | ||
|
||
const cleanup = () => { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -97,4 +97,4 @@ async function main() { | |
return vat.close(); | ||
} | ||
|
||
main(); | ||
await main().catch(err => console.log(err)); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* eslint @typescript-eslint/no-floating-promises: "warn" */ | ||
/* global issueCommand */ | ||
(async () => { | ||
void (async () => { | ||
issueCommand(new TextEncoder().encode('Hello, World!').buffer); | ||
})(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add a comment in this case that it's safe to ignore the result because it simply means we may not have cleaned up a temp directory.