Skip to content

.load ignores last line of file when it doesn't include a newline. #47305

@harrisi

Description

@harrisi

Version

v19.8.1

Platform

Darwin 22.4.0 Darwin Kernel Version 22.4.0: Mon Mar 6 21:01:02 PST 2023; root:xnu-8796.101.5~3/RELEASE_ARM64_T8112 arm64

Subsystem

repl

What steps will reproduce the bug?

$ node
> fs.writeFileSync('foo.js', '{\n}')
undefined
> .load foo.js
{

...

(To be clear, it prompts for more text, it doesn't loop forever.)

How often does it reproduce? Is there a required condition?

Always

What is the expected behavior? Why is that the expected behavior?

> .load foo.js
{
}

{}

What do you see instead?

{

...

(To be clear, it prompts for more text, it doesn't loop forever.)

Additional information

This seems related to #46731.

Metadata

Metadata

Assignees

No one assigned

    Labels

    replIssues and PRs related to the REPL subsystem.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions