Closed dakom closed 4 years ago
you see the error on linux or windows? can you provide the error?
Windows
The system cannot find the file specified.
[cargo-make] ERROR - Error while executing command, exit code: 2
The toml (from cargo-make
) is:
[tasks.clean-rust]
script_runner = "@shell"
script = ["rm -rf ./rust/pkg"]
Resulting command is
rmdir /S /Q .\rust\pkg
you can add a condition to the task "file_exists" so this will only execute if the dir exists
is there a way to add a condition to each line in a task's script?
Right now I'm doing this, as a workaround... kinda ugly imho:
[tasks.clean-rust]
run_task = [{name = [
"clean-rust1",
"clean-rust2",
"clean-rust3",
]}]
[tasks.clean-rust1]
script_runner = "@shell"
script = ["rm -rf ./_static/wasm/core/pkg"]
condition = {files_exist = ["./_static/wasm/core/pkg"]}
[tasks.clean-rust2]
script_runner = "@shell"
script = ["rm -rf ./rust/target"]
condition = {files_exist = ["./rust/target"]}
[tasks.clean-rust3]
script_runner = "@shell"
script = ["rm -rf ./rust/pkg"]
condition = {files_exist = ["./rust/pkg"]}
nope. shell2batch is limited, but if there is a flag to rmdir that can silence this error i can add it. need to check
windows doesn't provide such option, so either add the condition or add ignore_errors=true
ok cool. can ignore_errors=true
be set for a given task only?
nm I see that it can. Thanks!
@dakom you can now put @duckscript
instead of shell and it should work cross platform without errors.
no need for conditions or to ignore errors
running
rm -rf
on a non-existent directory gives an errorwould be nice if the default could be in that case to not have an error (rather than needing to do conditional checks before running, for use in
cargo-make
)