Skip to content

Node in terminal window gives error - Cannot read property 'setRawMode' of null #41330

@5saviahv

Description

@5saviahv

Version

17.3.0

Platform

Linux JPC 5.4.0-77-generic #86~18.04.1-Ubuntu SMP Fri Jun 18 01:23:22 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

Subsystem

tty

What steps will reproduce the bug?

  • open terminal window
  • start node
  • type: process.stdin.push(null)

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

it happens every time

What is the expected behavior?

  • show false
  • set terminal in not 'raw' mode
  • exit node

What do you see instead?

I see error message also

output:

joe@JPC:~/Downloads/Node/node-v17.3.0-linux-x64/bin$ ./node 
Welcome to Node.js v17.3.0.
Type ".help" for more information.
> process.stdin.push(null)
false
> node:tty:75
  const err = this._handle.setRawMode(flag);
                           ^

TypeError: Cannot read properties of null (reading 'setRawMode')
    at ReadStream.setRawMode (node:tty:75:28)
    at REPLServer.[_setRawMode] [as _setRawMode] (node:internal/readline/interface:350:18)
    at REPLServer.close (node:internal/readline/interface:493:24)
    at REPLServer.<anonymous> (node:repl:1048:7)
    at Object.onceWrapper (node:events:509:28)
    at REPLServer.emit (node:events:390:28)
    at REPLServer.emit (node:domain:475:12)
    at onwritten (node:internal/repl/history:149:14)
    at FSReqCallback.wrapper [as oncomplete] (node:fs:801:5)
    at FSReqCallback.callbackTrampoline (node:internal/async_hooks:130:17)

Node.js v17.3.0
joe@JPC:~/Downloads/Node/node-v17.3.0-linux-x64/bin$ 

Additional information

In node v0.12 & v4 it behaves like expected
In node v6, v8, v10, v12, v14, v16, v17 it gives this error

Metadata

Metadata

Assignees

No one assigned

    Labels

    ttyIssues and PRs related to the tty subsystem.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions