René's URL Explorer Experiment


Title: How to programmatically save multiline REPL history with \r (like native Node CLI)? · Issue #64508 · nodejs/node · GitHub

Open Graph Title: How to programmatically save multiline REPL history with \r (like native Node CLI)? · Issue #64508 · nodejs/node

X Title: How to programmatically save multiline REPL history with \r (like native Node CLI)? · Issue #64508 · nodejs/node

Description: Node.js Version v26.5.0 NPM Version 11.17.0 Operating System Linux archlinux 7.0.8-arch1-1 nodejs/help#1 SMP PREEMPT_DYNAMIC Fri, 15 May 2026 16:45:15 +0000 x86_64 GNU/Linux Subsystem repl Description Description When using the native No...

Open Graph Description: Node.js Version v26.5.0 NPM Version 11.17.0 Operating System Linux archlinux 7.0.8-arch1-1 nodejs/help#1 SMP PREEMPT_DYNAMIC Fri, 15 May 2026 16:45:15 +0000 x86_64 GNU/Linux Subsystem repl Descript...

X Description: Node.js Version v26.5.0 NPM Version 11.17.0 Operating System Linux archlinux 7.0.8-arch1-1 nodejs/help#1 SMP PREEMPT_DYNAMIC Fri, 15 May 2026 16:45:15 +0000 x86_64 GNU/Linux Subsystem repl Descript...

Opengraph URL: https://github.com/nodejs/node/issues/64508

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"How to programmatically save multiline REPL history with \\r (like native Node CLI)?","articleBody":"### Node.js Version\n\nv26.5.0\n\n### NPM Version\n\n11.17.0\n\n### Operating System\n\nLinux archlinux 7.0.8-arch1-1 nodejs/help#1 SMP PREEMPT_DYNAMIC Fri, 15 May 2026 16:45:15 +0000 x86_64 GNU/Linux\n\n### Subsystem\n\nrepl\n\n### Description\n\n### Description\n\nWhen using the native Node.js binary REPL via terminal (`node`), multiline inputs (like objects, functions, or arrays) are correctly saved into `.node_repl_history` as a single physical line, where internal line breaks are represented by `\\r`. \n\nHowever, when creating a REPL instance programmatically using `repl.start()` and initializing history via `repl.setupHistory()`, every press of the `Enter` key triggers a write to the history file immediately. This breaks multiline inputs into separate, independent physical lines separated by `\\n`. This completely breaks history navigation inside the programmatic REPL (pressing the Arrow Up key scrolls lines one by one instead of expanding the whole block).\n\n### Minimal Reproducible Example\n\nHere is a short script demonstrating the issue:\n\n```javascript\nimport repl from 'node:repl';\nimport path from 'node:path';\n\nconst historyFile = path.join(import.meta.dirname, 'history.txt');\n\nconst r = repl.start({ prompt: '> ', terminal: true });\nr.setupHistory(historyFile, () => {});\n```\n\nIf you run this script and type a multiline array:\n```javascript\n> [1,\n| 2]\n[ 1, 2 ]\n>\n```\n\nThe resulting `history.txt` contains separate lines in reverse order:\n```text\n2]\n[1,\n```\n\nWhile the native node history file combines them into a single line using `\\r`: \n```text\n2]\\r[1,\n```\n\n### Question\n\nIs there a clean, official way to make a programmatic REPL handle multiline history exactly like the native CLI?\n\n\n### Minimal Reproduction\n\n_No response_\n\n### Output\n\n_No response_\n\n### Before You Submit\n\n- [x] I have looked for issues that already exist before submitting this\n- [x] My issue follows the guidelines in the README file, and follows the 'How to ask a good question' guide at https://stackoverflow.com/help/how-to-ask","author":{"url":"https://github.com/psqq","@type":"Person","name":"psqq"},"datePublished":"2026-07-09T07:14:04Z","url":"https://github.com/nodejs/node/issues/64508"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:9e7668b8-07d5-d38c-eb84-f6eb8b8005ee
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idC4C6:5463F:5C6775:7D2208:6AED2251
html-safe-nonceb3cbacd7937df96ad33bff672d6c8099497a13fabc964052c822cbe6ad759adb
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDNEM2OjU0NjNGOjVDNjc3NTo3RDIyMDg6NkFFRDIyNTEiLCJ2aXNpdG9yX2lkIjoiNzY0NDA0OTM4NDk0MDU3NzM2MSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmacb8f1579c0482cc25bbb12d36169ebae0bc7838afd7631f4b55bc34d6b6578edc
hovercard-subject-tagissue:4887123780
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/nodejs/node/64508/issue_layout
twitter:imagehttps://opengraph.githubassets.com/c40ab480f5b48b4d07d621de582caaf1d6e1db1cb0d0196e890b59e21d441543/nodejs/node/issues/64508
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/c40ab480f5b48b4d07d621de582caaf1d6e1db1cb0d0196e890b59e21d441543/nodejs/node/issues/64508
og:image:altNode.js Version v26.5.0 NPM Version 11.17.0 Operating System Linux archlinux 7.0.8-arch1-1 nodejs/help#1 SMP PREEMPT_DYNAMIC Fri, 15 May 2026 16:45:15 +0000 x86_64 GNU/Linux Subsystem repl Descript...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamepsqq
hostnamegithub.com
expected-hostnamegithub.com
Nonee3e0f7f63e50c6fe879198a93a0a023a648ecc0a5e9bc3b5e033ac57172237e6
turbo-cache-controlno-preview
go-importgithub.com/nodejs/node git https://github.com/nodejs/node.git
octolytics-dimension-user_id9950313
octolytics-dimension-user_loginnodejs
octolytics-dimension-repository_id27193779
octolytics-dimension-repository_nwonodejs/node
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id27193779
octolytics-dimension-repository_network_root_nwonodejs/node
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release707a24b346ac8a82878b9c084efaa38a997660cb
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/nodejs/node/issues/64508#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fnodejs%2Fnode%2Fissues%2F64508
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fnodejs%2Fnode%2Fissues%2F64508
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=nodejs%2Fnode
Reloadhttps://github.com/nodejs/node/issues/64508
Reloadhttps://github.com/nodejs/node/issues/64508
Reloadhttps://github.com/nodejs/node/issues/64508
nodejshttps://github.com/nodejs
nodehttps://github.com/nodejs/node
Codehttps://github.com/nodejs/node
Issues657 (657)https://github.com/nodejs/node/issues
Pull requests666 (666)https://github.com/nodejs/node/pulls
Actionshttps://github.com/nodejs/node/actions
Projectshttps://github.com/nodejs/node/projects
Security and qualityhttps://github.com/nodejs/node/security
Insightshttps://github.com/nodejs/node/pulse
https://github.com/nodejs/node
New issuehttps://github.com/login?return_to=https://github.com/nodejs/node/issues/64508
New issuehttps://github.com/login?return_to=https://github.com/nodejs/node/issues/64508
Featurehttps://github.com/nodejs/node/issues?q=type:"Feature"
How to programmatically save multiline REPL history with \r (like native Node CLI)?https://github.com/nodejs/node/issues/64508#top
https://github.com/psqq
psqqhttps://github.com/psqq
on Jul 9, 2026https://github.com/nodejs/node/issues/64508#issue-4887123780
nodejs/help#1https://github.com/nodejs/help/pull/1
https://stackoverflow.com/help/how-to-askhttps://stackoverflow.com/help/how-to-ask
https://github.com/psqq
psqqhttps://github.com/psqq
on Jul 14, 2026https://github.com/nodejs/node/issues/64508#issuecomment-4974115938
https://gemini.google.com/share/2049b04d18e2?skid=6dff2ae9-0a8e-4d4f-a868-b6a6072114cdhttps://gemini.google.com/share/2049b04d18e2?skid=6dff2ae9-0a8e-4d4f-a868-b6a6072114cd
https://github.com/avivkeller
avivkellerhttps://github.com/avivkeller
on Jul 14, 2026https://github.com/nodejs/node/issues/64508#issuecomment-4974115957
avivkellerhttps://github.com/avivkeller
Featurehttps://github.com/nodejs/node/issues?q=type:"Feature"
on Jul 14, 2026https://github.com/nodejs/node/issues/64508#event-27985595527
avivkellerhttps://github.com/avivkeller
nodejs/helphttps://github.com/nodejs/help
on Jul 14, 2026https://github.com/nodejs/node/issues/64508#event-27985595631
https://github.com/mhayk
mhaykhttps://github.com/mhayk
on Jul 15, 2026https://github.com/nodejs/node/issues/64508#issuecomment-4979390613
4a4aa58https://github.com/nodejs/node/commit/4a4aa58fa4a3736744f605abc70eb6c167aadf9d
mhaykhttps://github.com/mhayk
on Jul 15, 2026https://github.com/nodejs/node/issues/64508#event-28010288305
repl: keep entries added while history file is loadinghttps://github.com/mhayk/node/commit/76d0f7499ccc950d1d742f0697587b697dd63f93
76d0f74https://github.com/mhayk/node/commit/76d0f7499ccc950d1d742f0697587b697dd63f93
https://github.com/psqq
psqqhttps://github.com/psqq
on Jul 15, 2026https://github.com/nodejs/node/issues/64508#issuecomment-4982729967
@mhaykhttps://github.com/mhayk
psqqhttps://github.com/psqq
completedhttps://github.com/nodejs/node/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
on Jul 15, 2026https://github.com/nodejs/node/issues/64508#event-28025710215
nodejs-github-bothttps://github.com/nodejs-github-bot
on Aug 23, 2026https://github.com/nodejs/node/issues/64508#event-29877078747
repl: keep entries added while history file is loadinghttps://github.com/nodejs/node/commit/453f47acda92abf75a17dcd419f4a35610cf661b
453f47ahttps://github.com/nodejs/node/commit/453f47acda92abf75a17dcd419f4a35610cf661b
aduh95https://github.com/aduh95
on Aug 25, 2026https://github.com/nodejs/node/issues/64508#event-30010193575
repl: keep entries added while history file is loadinghttps://github.com/nodejs/node/commit/9790ae726107a3bf9a954d000c294ab601b90ae3
9790ae7https://github.com/nodejs/node/commit/9790ae726107a3bf9a954d000c294ab601b90ae3
repl: keep entries added while history file is loadinghttps://github.com/nodejs/node/commit/bb499c312ea335bf63f162a4fb546ad4da465922
bb499c3https://github.com/nodejs/node/commit/bb499c312ea335bf63f162a4fb546ad4da465922
repl: keep entries added while history file is loadinghttps://github.com/nodejs/node/commit/67ca879d47ce12472ecf39c89b74438ea9650bdd
67ca879https://github.com/nodejs/node/commit/67ca879d47ce12472ecf39c89b74438ea9650bdd
aduh95https://github.com/aduh95
on Sep 7, 2026https://github.com/nodejs/node/issues/64508#event-30681674776
repl: keep entries added while history file is loadinghttps://github.com/nodejs/node/commit/6d195560f0ca1f4354f00a752d07f3b1cf490211
6d19556https://github.com/nodejs/node/commit/6d195560f0ca1f4354f00a752d07f3b1cf490211
repl: keep entries added while history file is loadinghttps://github.com/nodejs/node/commit/4f6eda3c230b5f86cf00198c5afd8f02a978a859
4f6eda3https://github.com/nodejs/node/commit/4f6eda3c230b5f86cf00198c5afd8f02a978a859
Sign up for freehttps://github.com/signup?return_to=https://github.com/nodejs/node/issues/64508
Sign in to commenthttps://github.com/login?return_to=https://github.com/nodejs/node/issues/64508
Featurehttps://github.com/nodejs/node/issues?q=type:"Feature"
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.