Skip to content

clipboard.write() silently reports success even when copy fails on Linux #31253

@RajdeepSaiPutta

Description

@RajdeepSaiPutta

Problem Description

In Linux, clipboard.write() can report success silently despite there being no clipboard utility at all.

Causes of the problem

  1. The actual method used for writing into clipboard throws an exception which is silenced with .catch(() => undefined) (for osascript, wl-copy, xclip, xsel or clipboardy)
  2. OSC52 fails silently if stdout is not a TTY
  3. There is no verification — write() returns Promise<void>

Desired Solution

The calling code should get some indication of whether copying has happened or not.
Failed copy methods should not be silently ignored.
Copying through OSC52 should not silently fail.

Environment where the problem occurs

  • Linux (doesn't depend on particular distribution)
  • Terminal that doesn't have OSC52 functionality and/or has no clipboard utilities

Metadata

Metadata

Assignees

Labels

No labels
No labels

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