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

0 votes
Answer 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
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...

1,225 views 4 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