Skip to content

scripts can't operate as part of a pipeline #9373

@amtoine

Description

@amtoine

Describe the bug

with a simple script that returns a simple data structure, it does not appear as true data in the REPL 🤔

How to reproduce

  1. in foo.nu, put the following
let prs = [
    [foo bar];
    [1 2]
    [3 4]
]

$prs
  1. run the script with nu foo.nu
    => this will show the table as expected
  2. run the script as nu foo.nu | columns
Error: nu::shell::only_supports_this_input_type

  × Input type not supported.
   ╭─[entry #4:1:1]
 1 │ nu foo.nu | columns
   · ─┬          ───┬───
   ·  │             ╰── only record or table input data is supported
   ·  ╰── input type: raw data
   ╰────
  1. run the script as nu foo.nu | get 0
Error: nu::shell::io_error

  × I/O error
  help: can't follow stream paths
  1. and finally nu foo.nu | select foo does not give anything...

👉 looks like foo.nu is returning some strange output 🤔

Expected behavior

i expected nu foo.nu to return the table as-is, allowing all the classic operations on tables.

Note
i get the exact same behaviour with the following more explicit script

def main [] {
    let prs = [
        [foo bar];
        [1 2]
        [3 4]
    ]

    return $prs
}

Screenshots

No response

Configuration

key value
version 0.80.1
branch main
commit_hash acd2fe8
build_os linux-x86_64
build_target x86_64-unknown-linux-gnu
rust_version rustc 1.68.2 (9eb3afe9e 2023-03-27)
rust_channel 1.68.2-x86_64-unknown-linux-gnu
cargo_version cargo 1.68.2 (6feb7c9cf 2023-03-26)
build_time 2023-06-03 13:10:15 +02:00
build_rust_channel release
features default, sqlite, trash, which, zip
installed_plugins

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    status:needs-designthis feature requires designusage:script-fileIssues related to executing a script file (as opposed to a module or sourcing)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions