Skip to content

[fork-ffi] console: warn — Upstream maps warn :: String -> Effect Unit to console.warn,… #77

@Unisay

Description

@Unisay

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

Upstream maps warn :: String -> Effect Unit to console.warn, which writes to stderr in Node. The Lua FFI uses print (stdout), so warnings are indistinguishable from log output and cannot be filtered via stderr. (By contrast info/debug/log -> stdout is correct, since console.info/console.debug/console.log all target stdout, so only warn and error are misrouted.)

Current (Lua):

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

Expected: console.warn writes to stderr; the Lua equivalent is io.stderr:write(s .. "\n").

Proposed fix:

warn = (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