Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't suppress error in #12585 with a try #12586

Open
NotTheDr01ds opened this issue Apr 19, 2024 · 0 comments
Open

Can't suppress error in #12585 with a try #12586

NotTheDr01ds opened this issue Apr 19, 2024 · 0 comments
Labels
error-handling How errors in externals/nu code are caught or handled programmatically (see also unhelpful-error) file-system Related to commands and core nushell behavior around the file system needs-triage An issue that hasn't had any proper look

Comments

@NotTheDr01ds
Copy link
Contributor

Describe the bug

I came across this when answering Question #12560, but I believe there are two issues at play. This is the second part of the issue. The first part is in #12585.

Given the error condition in #12585, I had hoped to suppress it with try { rm -rf $in.name}, but it occurs anyway.

How to reproduce

Using a slightly modified version of the test code in #12585, wrap the rm attempt in a try:

for _ in 1..10 {
  let dir = mktemp -d
  cd $dir
  mkdir foo
  touch foo/fru
  print (ls **/*)
  ls **/*
  | par-each {
      let filename = $in.name
      # print $'Deleting ($filename)'
      try { rm -rf $filename }
    }
  cd -
  rm -rf $dir
}

However, the error still appears.

Expected behavior

Just as with try { rm fileDoesntExist }, I would expect to be able to suppress the error.

Screenshots

No response

Configuration

key value
version 0.92.2
branch
commit_hash
build_os linux-x86_64
build_target x86_64-unknown-linux-gnu
rust_version rustc 1.77.2 (25ef9e3d8 2024-04-09)
rust_channel 1.77.2-x86_64-unknown-linux-gnu
cargo_version cargo 1.77.2 (e52e36006 2024-03-26)
build_time 2024-04-12 20:02:27 -04:00
build_rust_channel release
allocator mimalloc
features dataframe, default, sqlite, trash, which
installed_plugins

Additional context

Perhaps this is just expected, since it is an internal error condition rather than a script error. However, given the formatting of the error, it "looks like" an error that could be handled with try.

@NotTheDr01ds NotTheDr01ds added the needs-triage An issue that hasn't had any proper look label Apr 19, 2024
@sholderbach sholderbach added file-system Related to commands and core nushell behavior around the file system error-handling How errors in externals/nu code are caught or handled programmatically (see also unhelpful-error) labels May 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
error-handling How errors in externals/nu code are caught or handled programmatically (see also unhelpful-error) file-system Related to commands and core nushell behavior around the file system needs-triage An issue that hasn't had any proper look
Projects
None yet
Development

No branches or pull requests

2 participants