Modifying working directory for all sub tasks? #1002
-
Is there a good way to set up the working directory for all sub tasks? [tasks.task1]
script = "pwd"
[tasks.task2]
script = "ls"
[tasks.multi]
run_task = { name = ["task1", "task2"] } and working in a directory such as:
I want to run
I found that I can share the working directory via an environment variable and move into that directory by [tasks.task1]
script = '''
cd $CWD
pwd
'''
...
[tasks.multi]
env = { CWD = "./package" }
... It works fine but I'm wondering if there's a more reasonable way. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
@fujidaiti you can do that via duckscript. |
Beta Was this translation helpful? Give feedback.
-
I leave my solution here for future readers with the same question. This works fine for me. [tasks.task1]
script = "pwd"
[tasks.task2]
script = "ls"
[tasks.multi]
script_runner = "@duckscript"
script = '''
cd ./package
cm_run_task task1
cm_run_task task2
''' |
Beta Was this translation helpful? Give feedback.
@fujidaiti you can do that via duckscript.
so you can have one task running duckscript and there just do 'cd whatever' and from that point on, the working directory is that until you change it back via script.
duckscript is embedded in cargo-make therefore, it is able to control working directory, env vars and so on....