diff options
Diffstat (limited to 'intern/cycles/util/util_cuda.cpp')
-rw-r--r-- | intern/cycles/util/util_cuda.cpp | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/intern/cycles/util/util_cuda.cpp b/intern/cycles/util/util_cuda.cpp index 2960022fd8d..2716f00e173 100644 --- a/intern/cycles/util/util_cuda.cpp +++ b/intern/cycles/util/util_cuda.cpp @@ -17,6 +17,7 @@ */ #include <stdlib.h> +#include <stdio.h> #include "util_cuda.h" #include "util_debug.h" @@ -413,8 +414,18 @@ string cuCompilerPath() return nvcc; #ifndef _WIN32 - if(system("which nvcc") == 0) - return "nvcc"; + { + FILE *handle = popen("which nvcc", "r"); + if(handle) { + char buffer[4096] = {0}; + int len = fread(buffer, 1, sizeof(buffer) - 1, handle); + buffer[len] = '\0'; + pclose(handle); + + if(buffer[0]) + return "nvcc"; + } + } #endif return ""; |