# TCastleProcess and ExecuteCommand available with both FPC and Delphi, no more cryptic "Failed to execute  : 4551" when Windows "Smart App Control" blocks us

**URL:** <https://forum.castle-engine.io/t/tcastleprocess-and-executecommand-available-with-both-fpc-and-delphi-no-more-cryptic-failed-to-execute-4551-when-windows-smart-app-control-blocks-us/2169>\
**Category:** News\
**Created:** [June 28, 2026, 4:58am UTC](https://forum.castle-engine.io/t/tcastleprocess-and-executecommand-available-with-both-fpc-and-delphi-no-more-cryptic-failed-to-execute-4551-when-windows-smart-app-control-blocks-us/2169 "2026-06-28T04:58:42Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![michalis](https://forum.castle-engine.io/user_avatar/forum.castle-engine.io/michalis/32/3_2.png) [@michalis](https://forum.castle-engine.io/u/michalis)\
**Post date:** [June 28, 2026, 4:58am UTC](https://forum.castle-engine.io/t/tcastleprocess-and-executecommand-available-with-both-fpc-and-delphi-no-more-cryptic-failed-to-execute-4551-when-windows-smart-app-control-blocks-us/2169/1 "2026-06-28T04:58:43Z")

</div>

| [![Editor executing compiler and game - this is one process calling another](https://forum.castle-engine.io/uploads/default/original/2X/0/094f46a66cf860a27f4b9abd08f19fdaa25dc318.png)](https://castle-engine.io/wp/wp-content/uploads/2026/06/walking_adventure_processes.png "Editor executing compiler and game - this is one process calling another") |
| [![Effect when &quot;Smart App Control&quot; blocks us](https://forum.castle-engine.io/uploads/default/original/2X/e/eed30e9ef4602d07fc440c4cf269e9cd4d3eb410.png)](https://castle-engine.io/wp/wp-content/uploads/2026/06/smart_app_control_1.png "Effect when &quot;Smart App Control&quot; blocks us") |
| [![Effect when &quot;Smart App Control&quot; blocks us](https://forum.castle-engine.io/uploads/default/original/2X/a/a707fd8b623ecac6c6578ad97772fd0c04ba75fd.png)](https://castle-engine.io/wp/wp-content/uploads/2026/06/smart_app_control_2.png "Effect when &quot;Smart App Control&quot; blocks us") |

We refactored our process running code (when one application wants to run another). This is used throughout our tools ([build tool](https://castle-engine.io/build_tool), [editor](https://castle-engine.io/editor)) but we also have uses for it in the engine itself. Refactoring this into a nice unit gives us more possibilities, for now and for the future:)

1. The code is now in a nice unit `CastleInternalProcess` available throughout the engine, with `TCastleProcess` class and our routines like `ExecuteCommand`, `ExecuteCommandCapture`.
  - As the name suggests, we still consider this an _internal_ unit, so if you decide to use it in your own applications -\> you risk that we break API.

  - That said, there’s no hiding that the unit is useful right now, with FPC+Delphi capability to run processes. Let us know how do you use it, and maybe we’ll just rename it to `CastleProcess` at some point.

  - Since this is internal now, the API docs are not generated by PasDoc, but you can just [read the source code](https://github.com/castle-engine/castle-engine/blob/master/src/files/castleinternalprocess.pas) for the docs in comments.

2. The code is simpler and better organized than previous code in build tool / editor. Some of the old internal code had “historical baggage” (e.g. how is environment overridden for the child process) which was cleaned up now.

3. Since all usage now goes through `TCastleProcess`, we can reliably make a better error message when execution on Windows is blocked by _“Smart App Control”_. FPC Process was showing cryptic _“Failed to execute : 4551”_ message in this case. This is quite important — as this message is killing our usage on Windows now!

4. `TCastleProcess` and helpers are now implemented also for Delphi (for Windows, Linux, macOS/Intel, macOS/Aarch64).

5. We feature helpers like:
  - `ExecuteCommand` – wait for the executed process to finish, don’t capture anything, return status.

  - `ExecuteCommandCheckStatus` – wait for the executed process to finish, don’t capture anything, raise exception if non-zero status.

  - `ExecuteCommandCapture` – wait for the executed process to finish, capture stdout/stderr to string. This one is for now still FPC-only.

6. `OpenDocument`, `OpenUrl` on Unix are simpler now — they just use `TCastleProcess` through a simple `ExecuteCommandNoWait`, with both compilers.
