I am writing a Java program that feeds data into the git fast-import
function. Currently, I know all my formatting works and conforms to https://git-scm.com/docs/git-fast-import#_signals However, my problem is sending the final "kill" command: SIGUSR1
.
I get things to work right now by running this command type fast-import.script | git fast-import
. That fact that this works tells me my formatting and such is proper. But, I know there is a way to continuously run git fast-import
and feed commands into its standard-input, but the very last command has to be SIGUSR1
Without sending a SIGUSR1
the fast-import utility doesn't know to end. I have tried a few things:
1- Destroying the process using regular Java Process API commands such as
fastImportProcess.destroyForcibly();
2- Use a Java library WinProcess (Maven) to find the pid and kill it.
WinProcess wp = new WinProcess(fastImportProcess);
wp.killRecursively();
That didn't work either. And I tried combinations of things related to the Java Process API and the WinProcess API, etc. Although I can get WinProcess to force the fast-import utility to shut down, it doesn't actually create my commits.
3- Lastly, endlessly research what SIGUSR1
is and all I can come up with is SIGUSR
is some kind of user-defined signal. C- what exactly is SIGUSR1 syntactically Not too helpful.
I don't think this issue is Java related per-se, its really about how to use git fast-import
. I notice when I run fast-import in the CLI, when I press ctrl-c
the commits execute. But I don't know exactly how to do this in Java.