Skip to content

[fork-ffi] console: error — Upstream purescript-console maps error :: String -> Effect Unit to… #76

@Unisay

Description

@Unisay

Package: purescript-lua-console
File: src/Effect/Console.lua
Function: error
Class: semantics Severity: low

Upstream purescript-console maps error :: String -> Effect Unit to console.error, which writes to stderr in Node. The Lua FFI routes it through print, which writes to stdout. Consumers that separate stdout/stderr (the normal reason to call error rather than log) will see error output mixed into stdout, losing the only behavioral distinction error has from log in this port. Confirmed under Lua 5.1: C.error("err-msg")() emits to stdout, not stderr.

Current (Lua):

error = (function(s) return function() print(s) end end),

Expected: console.error writes to stderr; the Lua equivalent is io.stderr:write(s .. "\n"). print() unconditionally targets stdout.

Proposed fix:

error = (function(s) return function() io.stderr:write(tostring(s) .. "\n") end end),

Found by the FFI audit; reproduced under Lua 5.1.

Metadata

Metadata

Assignees

No one assigned

    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