I'd like to include logic to avoid breaking my functions in different environments, like the cloud (which lacks support for many things) or the wolfram engine, or CDF. For example, I'd like a test:

If[!$RunningInCloud, Print @ SystemInformation[]]

Since SystemInformation is not supported in the cloud, what would $RunningInCloud be?

  • 6
    $\begingroup$ I think you're looking for $CloudEvaluation. $\endgroup$ – Carl Woll Jan 6 at 23:26
  • 5
    $\begingroup$ Duplicate of: Detect if code is running in the cloud $\endgroup$ – Leonid Shifrin Jan 6 at 23:52
  • 2
    $\begingroup$ What about the other possibilities: whether it’s in the engine, command line, or subkernel $\endgroup$ – user5601 Jan 7 at 3:28
  • 1
    $\begingroup$ Yes, that’s what I’m also looking for - a unified answer $\endgroup$ – M.R. Jan 7 at 3:31
  • 3
    $\begingroup$ This is not a duplicate question and should be reopened. It is nontrivial to detect if code is running in PlayerPro, or Kernel-only without a Notebook-Frontend. I have struggled with this in the past. $\endgroup$ – Rolf Mertig Jan 7 at 8:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.