Windows fixes

This commit is contained in:
Jack Andersen 2016-12-24 21:02:34 -10:00
parent 75847c67d3
commit d7c5dff1f0
3 changed files with 9 additions and 9 deletions

View File

@ -1,4 +1,4 @@
import bpy, sys, os, re, struct
import bpy, sys, os, re, struct, traceback
ARGS_PATTERN = re.compile(r'''(?:"([^"]+)"|'([^']+)'|(\S+))''')
@ -16,9 +16,10 @@ if sys.platform == "win32":
readfd = msvcrt.open_osfhandle(readfd, os.O_RDONLY | os.O_BINARY)
writefd = msvcrt.open_osfhandle(writefd, os.O_WRONLY | os.O_BINARY)
err_path = "/Temp"
if 'TEMP' in os.environ:
err_path = os.environ['TEMP']
else:
err_path = "/tmp"
if 'TMPDIR' in os.environ:
err_path = os.environ['TMPDIR']
@ -476,7 +477,6 @@ try:
hecl.command(cmdargs, writepipestr, writepipebuf)
except Exception:
import traceback
fout = open(err_path, 'w')
traceback.print_exc(file=fout)
fout.close()

View File

@ -50,9 +50,8 @@ public:
Frame
};
private:
std::atomic_bool m_lock;
std::atomic_bool m_lock = false;
#if _WIN32
HANDLE m_blenderProc = 0;
PROCESS_INFORMATION m_pinfo = {};
std::thread m_consoleThread;
bool m_consoleThreadRunning = true;

View File

@ -183,7 +183,7 @@ void BlenderConnection::_blenderDied()
std::unique_ptr<char[]> buf(new char[len+1]);
memset(buf.get(), 0, len+1);
fread(buf.get(), 1, len, errFp);
BlenderLog.report(logvisor::Fatal, "\n%s", buf.get());
BlenderLog.report(logvisor::Fatal, "\n%.*s", int(len), buf.get());
}
}
BlenderLog.report(logvisor::Fatal, "Blender Exception");
@ -401,7 +401,8 @@ BlenderConnection::BlenderConnection(int verbosityLevel)
#endif
/* Stash error path and unlink existing file */
m_errPath = hecl::SystemString(TMPDIR) + hecl::SysFormat(_S("/hecl_%016llX.derp"), (unsigned long long)m_blenderProc);
m_errPath = hecl::SystemString(TMPDIR) + hecl::SysFormat(_S("/hecl_%016llX.derp"),
(unsigned long long)m_pinfo.dwProcessId);
hecl::Unlink(m_errPath.c_str());
/* Handle first response */