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:

#!/bin/bash

source ~/.bash_profile
echo $PYTHONPATH
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 Join to answer
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 ...

231 views 0 3
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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot