Repository navigation
ProblemI’m unable to Steps to ReproduceCreate a directory called [tasks.cd]
command = "cd"
args = ["exists"]
[tasks.ls]
command = "ls"Output$ ls
exists Makefile.toml
$ cargo make ls
[cargo-make] INFO - cargo make 0.37.24
[cargo-make] INFO -
[cargo-make] INFO - Build File: Makefile.toml
[cargo-make] INFO - Task: ls
[cargo-make] INFO - Profile: development
[cargo-make] INFO - Execute Command: "ls"
exists Makefile.toml
[cargo-make] INFO - Build Done in 0.23 seconds.
$ cargo make cd
[cargo-make] INFO - cargo make 0.37.24
[cargo-make] INFO -
[cargo-make] INFO - Build File: Makefile.toml
[cargo-make] INFO - Task: cd
[cargo-make] INFO - Profile: development
[cargo-make] INFO - Execute Command: "cd" "exists"
[cargo-make] ERROR - Error while executing command, error: Os {
code: 2,
kind: NotFound,
message: "No such file or directory",
}
[cargo-make] WARN - Build Failed. |
Replies: 1 comment
|
Set [tasks.list-exists]
cwd = "exists"
command = "ls"Then run If you need several shell commands after changing directory, keep them in one script: [tasks.shell-example]
script_runner = "@shell"
script = '''
cd exists
pwd
ls
'''The directory change is local to that script; it doesn't change your interactive shell's directory or the working directory of a later task. The |
command = "cd"tries to launch an executable namedcd. In the shell you're using,cdis a shell builtin, so the error is about finding the command, rather than findingexists.Set
cwdon the task that should run inside that directory:Then run
cargo make list-exists. I tested this on 0.37.24: your originalcdtask fails as shown, while this task lists the contents ofexists.If you need several shell commands after changing directory, keep them in one script:
The directory change is local to that script; it doesn't change your interactive shell's directory or …