How to make Custom Action not waiting for script ends

Hi Author,

I have a custom action that call Tortiesehg Patch Reject File Editor since SourceTree currently doesn't provide this feature.

I wrote a script like this:


source ~/.bash_profile
echo $PATH

thg rejects $1

SourceTree will hang until I close the patch reject file editor window, that's not really what I expect.

Is it possible to provide an option that let SourceTree not wait for the script ending?

1 answer

1 accepted

Two ways:

  1. Enable the 'Open in a Separate Window' option on the Custom Action. This makes the command execute in a separate window which is not modal on the repository so you don't have to wait
  2. Add '&' to the end of your thg command so that the process is not blocking on the script

I tried them both, but unfortunently doesn't work for me.

Please define "doesn't work".

It just has no change, SourceTree still hang

'Hang'? No Custom Action I've ever seen causes this. Are you sure thg just doesn't like being called like this?

Finally I figure out the solution. It's not a problem of SourceTree

Use --nofork option for thg so that it will not run a background job for THG GUI.

thg --nofork rejects $1

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Brian Ganninger
Published Jan 23, 2018 in Sourcetree

Tip from the team: workflow and keyboard shortcuts

Supported Platforms macOS Sourcetree has a lot to offer and, like many developer tools, finding and using it all can be a challenge, especially for a new user. Everyone might not love ...

649 views 0 4
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