Commit 69759c0c by Hu Shiwen Committed by Tianqi Chen

add friendly tips when not found cl and link (#574)

* add friendly tips when not found cl and link

* fix lint
parent 1791b121
...@@ -79,10 +79,13 @@ BOOL APIENTRY DllMain( HMODULE hModule,\ ...@@ -79,10 +79,13 @@ BOOL APIENTRY DllMain( HMODULE hModule,\
temp_path = dllmain_path.replace("dllmain.cc", "") temp_path = dllmain_path.replace("dllmain.cc", "")
cl_cmd += ["-Fo:" + temp_path] cl_cmd += ["-Fo:" + temp_path]
try:
proc = subprocess.Popen( proc = subprocess.Popen(
cl_cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) cl_cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
(out, _) = proc.communicate() (out, _) = proc.communicate()
except FileNotFoundError:
raise RuntimeError("can not found cl.exe,"
"please run this in Vistual Studio Command Prompt.")
if proc.returncode != 0: if proc.returncode != 0:
msg = "Compilation error:\n" msg = "Compilation error:\n"
msg += str(out) msg += str(out)
...@@ -102,9 +105,13 @@ BOOL APIENTRY DllMain( HMODULE hModule,\ ...@@ -102,9 +105,13 @@ BOOL APIENTRY DllMain( HMODULE hModule,\
link_cmd += [temp_path + "dllmain.obj"] link_cmd += [temp_path + "dllmain.obj"]
link_cmd += ["-out:" + output] link_cmd += ["-out:" + output]
proc = subprocess.Popen( try:
link_cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) proc = subprocess.Popen(
(out, _) = proc.communicate() link_cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
(out, _) = proc.communicate()
except FileNotFoundError:
raise RuntimeError("can not found link.exe,"
"please run this in Vistual Studio Command Prompt.")
if proc.returncode != 0: if proc.returncode != 0:
msg = "Compilation error:\n" msg = "Compilation error:\n"
msg += str(out) msg += str(out)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment