AssetBuilderApplication_windows.cpp 937 B

1234567891011121314151617181920212223242526272829303132
  1. /*
  2. * Copyright (c) Contributors to the Open 3D Engine Project.
  3. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0 OR MIT
  6. *
  7. */
  8. #include <AssetBuilderApplication.h>
  9. #include "shlobj.h"
  10. namespace AssetBuilderApplicationPrivate
  11. {
  12. BOOL WINAPI CtrlHandlerRoutine(DWORD dwCtrlType)
  13. {
  14. (void)dwCtrlType;
  15. // Terminate the process when CTRL+C is pressed
  16. // Builder processes load user-code and we couldn't expect that every single gem
  17. // written by every single external developer be able to shut down cleanly.
  18. TerminateProcess(GetCurrentProcess(), UINT(-1)); // dont ever return a success error code from a terminated process.
  19. return TRUE;
  20. }
  21. }
  22. void AssetBuilderApplication::InstallCtrlHandler()
  23. {
  24. ::SetConsoleCtrlHandler(AssetBuilderApplicationPrivate::CtrlHandlerRoutine, TRUE);
  25. }