-
Hi. Today faced a problem with directory changing. I didn't found any docs examples or github issues, so sorry if I mistaken something. tasks:
create:
cmds:
- |
cd 'Level X\nupkg\'
pwd
rm *.nupkg
cd '..'
dotnet pack But I dont like it, because I'm basically smash all commands together into one. Is there a way to do something like this: tasks:
create:
cmds:
- cd 'Level X\nupkg\'
- pwd
- rm *.nupkg
- cd '..'
- dotnet pack or tasks:
create:
cmds:
- dir: 'Level X\nupkg\'
- pwd
- rm *.nupkg
- dir: '..'
- dotnet pack Thank you for your attention |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Each Task command is executed in isolation (i.e. its own shell) and so a Unfortunately, there is no # Does not work in 3.18
tasks:
create:
cmds:
- cmd: pwd
dir: 'Level X\nupkg\'
... The tasks:
remove-and-create:
cmds:
- task: remove
- task: create
remove:
dir: 'Level X\nupkg\'
cmds:
- pwd
- rm *.nupkg
create:
dir: 'Level X'
cmds:
- dotnet pack |
Beta Was this translation helpful? Give feedback.
Each Task command is executed in isolation (i.e. its own shell) and so a
cd
in one command will not affect the directory of any subsequent commands. This isolation is by design and cannot be changed.Unfortunately, there is no
dir
keyword at acmd
level either, so you also can't currently do anything like your second suggestion. However, I think this would be a valid feature request and would probably look something like this:The
dir
keyword is available at a task level though, so you could do something like this today: