-
Notifications
You must be signed in to change notification settings - Fork 30k
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
test_runner: do not spawn run in child processes to prevent infinite loops #48849
Conversation
Review requested:
|
7db06c7
to
73e4933
Compare
73e4933
to
1b31fa1
Compare
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.
I don't understand these changes - why would you both run inside the file and run with --test?
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.
If In order to reduce the number of test files, I wrote the test in the same file as run, I think there is a similar problem when |
I am also -1 on this change since this situation only happens when you explicitly |
I would also prefer not to land this. It might be worth a small note in the |
How do you think docs should be changed? I'll do it when I have time. |
@@ -17,6 +18,23 @@ describe('require(\'node:test\').run', { concurrency: true }, () => { | |||
for await (const _ of stream); | |||
}); | |||
|
|||
it('should run without infinite loops (self path)', { timeout: 10000 }, async () => { | |||
execFileSync( |
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.
Since execFileSync
is a synchronous function, it blocks the event loop until the command execution is complete and returns the result as a Buffer or a string, depending on the encoding used, hence to check execution in case of infinite loops, I think should be better to apply await
explicitly:
import { promisify } from 'util';
import { execFile } from 'child_process';
const execFilePromise = promisify(execFile);
execFileSync( | |
await execFilePromise( |
There seems to be agreement that we should not land this. I'm going to close this out, but thanks for the PR. |
Infinite loop occurs when the file in
options.files
hasrun
.I send this PR to avoid the risk of occuring infinite loop.
Ref: #48823