guybedford / chomp

'JS Make' - parallel task runner for the frontend ecosystem with a JS extension system.
https://chompbuild.com
Apache License 2.0
138 stars 7 forks source link

No args "thread 'main' panicked" #17

Closed canadaduane closed 2 years ago

canadaduane commented 2 years ago

I have a chompfile.toml in an empty directory like this:

version = 0.1

[[task]]
  name = "svelte"
  template = "chomp:svelte"
  [task.args]
    indir = "src"
    outdir = "dist"

When I type "chp" on the command line (no args), I get the following panic:

thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', src/task.rs:1452:44
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

With RUST_BACKTRACE=1 I get the following:

thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', src/task.rs:1452:44
stack backtrace:
   0: rust_begin_unwind
             at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/std/src/panicking.rs:517:5
   1: core::panicking::panic_fmt
             at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/core/src/panicking.rs:101:14
   2: core::panicking::panic
             at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/core/src/panicking.rs:50:5
   3: core::option::Option<T>::unwrap
             at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/core/src/option.rs:735:21
   4: chp::task::run::{{closure}}
             at /home/duane/tmp/chomp/src/task.rs:1452:20
   5: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/core/src/future/mod.rs:80:19
   6: chp::main::{{closure}}
             at /home/duane/tmp/chomp/src/main.rs:105:14
   7: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/core/src/future/mod.rs:80:19
   8: tokio::park::thread::CachedParkThread::block_on::{{closure}}
             at /home/duane/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.14.0/src/park/thread.rs:263:54
   9: tokio::coop::with_budget::{{closure}}
             at /home/duane/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.14.0/src/coop.rs:106:9
  10: std::thread::local::LocalKey<T>::try_with
             at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/std/src/thread/local.rs:399:16
  11: std::thread::local::LocalKey<T>::with
             at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/std/src/thread/local.rs:375:9
  12: tokio::coop::with_budget
             at /home/duane/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.14.0/src/coop.rs:99:5
  13: tokio::coop::budget
             at /home/duane/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.14.0/src/coop.rs:76:5
  14: tokio::park::thread::CachedParkThread::block_on
             at /home/duane/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.14.0/src/park/thread.rs:263:31
  15: tokio::runtime::enter::Enter::block_on
             at /home/duane/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.14.0/src/runtime/enter.rs:151:13
  16: tokio::runtime::thread_pool::ThreadPool::block_on
             at /home/duane/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.14.0/src/runtime/thread_pool/mod.rs:77:9
  17: tokio::runtime::Runtime::block_on
             at /home/duane/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.14.0/src/runtime/mod.rs:463:43
  18: chp::main
             at /home/duane/tmp/chomp/src/main.rs:113:5
  19: core::ops::function::FnOnce::call_once
             at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/core/src/ops/function.rs:227:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
guybedford commented 2 years ago

Thanks for sharing... just tried this out but can't reproduce - make sure you're pulling from the latest master branch.

I also changed the structure of the Svelte template today to just instead use the user-provided target and dependency, so it should now be:

version = 0.1

[[task]]
  name = "svelte"
  template = "chomp:svelte"
  target = "lib/#.js"
  deps = ["src/#.svelte"]

directly showing the interpolation makes it clearer and allows more configurability I think.

canadaduane commented 2 years ago

Ok. I'm pulling from latest, and copy-pasted the example from this project's root (chompfile.toml). Perhaps that needs to be updated then.

guybedford commented 2 years ago

Are you still getting the issue or can we close this?

canadaduane commented 2 years ago

When I use what you suggested it works, yes. However, I suggest you change this file: https://github.com/guybedford/chomp/blob/main/chompfile.toml#L3 (and perhaps use this issue to track?)

guybedford commented 2 years ago

Good point, done in https://github.com/guybedford/chomp/commit/465ed945c5fd8122b5d6460832b0437694d2029c. The test/chompfile.toml file always has up-to-date examples now.