Custom Action Command Prompt

I'm trying to create a custom action to open a command prompt to a given repository's working directory.  (I'm in Windows.)

 

I created a custom action with this script:

C:\Windows\System32\cmd.exe

And these parameters:

/k pushd $REPO

When I launch I can see the command executed like this:
 cmd.exe /k pushd C:\Users\CameronGocke\Git\api-portal

SourceTree; however, just spins and never launches the command prompt, whereas if I run the command directly I get what I'd expect to see. 

Update:

The response from @Geoff Joy seems to be on the right track in terms of the cause, but it is still not working properly.  SourceTree still waits for the process and all child processes to finish before it returns.  I have 2 scripts created for custom actions that both behave the same way.  The other is to launch VS Code and looks like this:

start "" "C:\Program Files (x86)\Microsoft VS Code\Code.exe" "%1"
exit

Though the script ends, SourceTree continues spinning until VS Code is closed and then control returns to SourceTree.

 

1 answer

Add an exit command to your script. SourceTree wants to see the CMD process close. If the window stays open there's no closure of the custom command. Exit 0 ought to do it. 

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Oct 23, 2018 in Sourcetree

Tip from the team: configure your repos for hosting goodness!

Supported Platforms macOS Windows We recently introduced support for additional hosting services such as GitHub Enterprise, GitLab (Cloud, Community Edition, Enterprise Edition), and...

844 views 3 2
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you