Skip to content

Command-level dir (or cd)? #940

Answered by pd93
MadL1me asked this question in Q&A
Discussion options

You must be logged in to vote

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 a cmd 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:

# Does not work in 3.18
tasks:
  create:
    cmds:
      - cmd: pwd
        dir: 'Level X\nupkg\'
      ...

The dir keyword is available at a task level though, so you could do something like this today:

tasks:
  remove-and-create:
    cmds:
      - task: remove

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by MadL1me
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants