nushell/crates/nu-protocol/src
Simon Curtis f05162811c
Implementing ByteStream interuption on infinite stream (#13552)
# Description

This PR should address #13530 by explicitly handling ByteStreams. 

The issue can be replicated easily on linux by running:

```nushell
open /dev/urandom | into binary | bytes at ..10
```

Would leave the output hanging and with no way to cancel it, this was
likely because it was trying to collect the input stream and would not
complete.

I have also put in an error to say that using negative offsets for a
bytestream without a length cannot be used.

```nushell
~/git/nushell> open /dev/urandom | into binary | bytes at (-1)..
Error: nu:🐚:incorrect_value

  × Incorrect value.
   ╭─[entry #3:1:35]
 1 │ open /dev/urandom | into binary | bytes at (-1)..
   ·                                   ────┬─── ───┬──
   ·                                       │       ╰── encountered here
   ·                                       ╰── Negative range values cannot be used with streams that don't specify a length
   ╰────
   ```

# User-Facing Changes

No operation changes, only the warning you get back for negative offsets

# Tests + Formatting

Ran `toolkit check pr ` with no errors or warnings

Manual testing of the example commands above

---------

Co-authored-by: Ian Manske <ian.manske@pm.me>
Co-authored-by: Simon Curtis <simon.curtis@candc-uk.com>
2025-01-11 13:28:08 -08:00
..
ast Change how and and or operations are compiled to IR to support custom values (#14653) 2024-12-25 06:12:53 -06:00
config Convert Path to list in main and preserve case (#14764) 2025-01-10 10:18:44 -06:00
debugger Add flag to debug profile to output duration field as Value::Duration (#14749) 2025-01-09 17:09:16 -06:00
engine Convert Path to list in main and preserve case (#14764) 2025-01-10 10:18:44 -06:00
errors Implementing ByteStream interuption on infinite stream (#13552) 2025-01-11 13:28:08 -08:00
ir Change how and and or operations are compiled to IR to support custom values (#14653) 2024-12-25 06:12:53 -06:00
pipeline Implementing ByteStream interuption on infinite stream (#13552) 2025-01-11 13:28:08 -08:00
plugin Change the usage misnomer to "description" (#13598) 2024-08-22 12:02:08 +02:00
process Fix non-zero exit code errors in middle of pipeline (#13899) 2024-10-02 06:04:18 -05:00
value Implementing ByteStream interuption on infinite stream (#13552) 2025-01-11 13:28:08 -08:00
alias.rs Change the usage misnomer to "description" (#13598) 2024-08-22 12:02:08 +02:00
did_you_mean.rs Improve case insensitivity consistency (#10884) 2023-11-08 23:58:54 +01:00
eval_base.rs Change append operator to concatenation operator (#14344) 2024-11-24 10:59:54 -08:00
eval_const.rs Add user autoload directory (#14669) 2025-01-02 16:10:05 -06:00
example.rs Overhaul the plugin cache file with a new msgpack+brotli format (#12579) 2024-04-21 07:36:26 -05:00
id.rs Make SpanId and RegId also use new ID struct (#13963) 2024-10-01 13:23:27 +02:00
lev_distance.rs Rework for new clippy lints (#12736) 2024-05-02 19:29:03 +02:00
lib.rs Start to Add WASM Support Again (#14418) 2024-11-30 07:57:11 -06:00
module.rs normalize special characters in module names to allow variable access (#14353) 2024-12-05 21:35:15 +08:00
parser_path.rs Replace raw usize IDs with new types (#13832) 2024-09-30 13:20:15 +02:00
signature.rs Deprecate date to-record and date to-table (#14319) 2024-11-29 23:06:26 +01:00
span.rs fix --ide-ast when there are errors (#13737) 2024-09-06 07:17:40 +08:00
syntax_shape.rs Make parsing for unknown args in known externals like normal external calls (#13414) 2024-07-21 01:32:36 -07:00
ty.rs Add run-time type checking for command pipeline input (#14741) 2025-01-08 23:09:47 +01:00