If it's getting stopped half way through, that means that PHP is being killed before execution completes (and generally without being given the ability to clean itself up). Running through the command line is unlikely to trigger the same scenario if it is indeed a process watcher that's killing it. You can trigger the cron within XF though and then watch the log to see it being built.
I have a suspicion that there may be environmental effects here, so the surrounding details may be relevant (what else is happening on the server at the time, load average, etc). It may be worth seeing what happens around the time the build fails.