Skip to content
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

add reproducer for TypeStrong/ts-node#1380 #14

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 11 additions & 1 deletion example.ts
Original file line number Diff line number Diff line change
@@ -1 +1,11 @@
console.log('Some .ts code reproducing a bug');
// Note: the segfault is random, so we have to run this multiple time
import { AsyncLocalStorage } from 'async_hooks';
const asyncStore = new AsyncLocalStorage;
function sleep(ms: number) { return new Promise(resolve => setTimeout(resolve, ms)) }
for(let i = 0; i < 1000; ++i) {
asyncStore.run(() => {}, async() => {
// may need to vary the delay depending on where this is running
await sleep(Math.random() * 100);
process.exit();
});
}
4 changes: 2 additions & 2 deletions run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ n lts
# Install package.json dependencies
yarn

# Run ts-node
yarn ts-node ./example.ts
# Run ts-node (multiple time to have a chance of catching the random crash)
for n in {1..10000} ; do yarn ts-node ./example.ts || code=$? && break ; done ; sh -c "exit $code"

echo "Process exited with code: $?"
echo
Expand Down