Skip to content

Add checks for ports#11214

Merged
fdncred merged 1 commit intonushell:mainfrom
nibon7:check-port
Dec 3, 2023
Merged

Add checks for ports#11214
fdncred merged 1 commit intonushell:mainfrom
nibon7:check-port

Conversation

@nibon7
Copy link
Copy Markdown
Contributor

@nibon7 nibon7 commented Dec 3, 2023

Description

This PR adds checks for ports. This fixes unexpected output similar to the one in the comment #11210 (comment).

  • before
/data/source/nushell> port 65536 99999                                                                                        
41233
  • after
/data/source/nushell> port 65536 99999                                                                                             
Error: nu::shell::cant_convert

  × Can't convert to u16.
   ╭─[entry #1:1:1]
 1 │ port 65536 99999
   ·      ──┬──
   ·        ╰── can't convert usize to u16
   ╰────
  help: out of range integral type conversion attempted (min: 0, max: 65535)

User-Facing Changes

N/A

Tests + Formatting

  • add port_out_of_range test

After Submitting

N/A

@fdncred
Copy link
Copy Markdown
Contributor

fdncred commented Dec 3, 2023

Appreciate the cleanup. Thanks!

@fdncred fdncred merged commit b227eea into nushell:main Dec 3, 2023
@nibon7 nibon7 deleted the check-port branch December 3, 2023 14:13
hardfau1t pushed a commit to hardfau1t/nushell that referenced this pull request Dec 14, 2023
# Description
This PR adds checks for ports. This fixes unexpected output similar to
the one in the comment
nushell#11210 (comment).

* before

```console
/data/source/nushell> port 65536 99999                                                                                        
41233
```

* after

```console
/data/source/nushell> port 65536 99999                                                                                             
Error: nu::shell::cant_convert

  × Can't convert to u16.
   ╭─[entry #1:1:1]
 1 │ port 65536 99999
   ·      ──┬──
   ·        ╰── can't convert usize to u16
   ╰────
  help: out of range integral type conversion attempted (min: 0, max: 65535)
```

# User-Facing Changes
N/A

# Tests + Formatting
* [x] add `port_out_of_range` test

# After Submitting
N/A
dmatos2012 pushed a commit to dmatos2012/nushell that referenced this pull request Feb 20, 2024
# Description
This PR adds checks for ports. This fixes unexpected output similar to
the one in the comment
nushell#11210 (comment).

* before

```console
/data/source/nushell> port 65536 99999                                                                                        
41233
```

* after

```console
/data/source/nushell> port 65536 99999                                                                                             
Error: nu::shell::cant_convert

  × Can't convert to u16.
   ╭─[entry nushell#1:1:1]
 1 │ port 65536 99999
   ·      ──┬──
   ·        ╰── can't convert usize to u16
   ╰────
  help: out of range integral type conversion attempted (min: 0, max: 65535)
```

# User-Facing Changes
N/A

# Tests + Formatting
* [x] add `port_out_of_range` test

# After Submitting
N/A
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants