win: Make console output work on cygwin.
This commit is contained in:
parent
9981fd51da
commit
1af4ecfc26
1 changed files with 12 additions and 8 deletions
|
@ -34,15 +34,19 @@ int APIENTRY wWinMain(HINSTANCE instance, HINSTANCE, wchar_t* cmd, int) {
|
||||||
int argc = 0;
|
int argc = 0;
|
||||||
wchar_t** wargv = ::CommandLineToArgvW(::GetCommandLineW(), &argc);
|
wchar_t** wargv = ::CommandLineToArgvW(::GetCommandLineW(), &argc);
|
||||||
|
|
||||||
// Attach to the parent console if we've got one so that stdio works
|
|
||||||
AttachConsole(ATTACH_PARENT_PROCESS);
|
|
||||||
|
|
||||||
FILE* dontcare;
|
|
||||||
freopen_s(&dontcare, "CON", "w", stdout);
|
|
||||||
freopen_s(&dontcare, "CON", "w", stderr);
|
|
||||||
freopen_s(&dontcare, "CON", "r", stdin);
|
|
||||||
|
|
||||||
scoped_ptr<base::Environment> env(base::Environment::Create());
|
scoped_ptr<base::Environment> env(base::Environment::Create());
|
||||||
|
|
||||||
|
// Make output work in console if we are not in cygiwn.
|
||||||
|
std::string os;
|
||||||
|
if (env->GetVar("OS", &os) && os != "cygwin") {
|
||||||
|
AttachConsole(ATTACH_PARENT_PROCESS);
|
||||||
|
|
||||||
|
FILE* dontcare;
|
||||||
|
freopen_s(&dontcare, "CON", "w", stdout);
|
||||||
|
freopen_s(&dontcare, "CON", "w", stderr);
|
||||||
|
freopen_s(&dontcare, "CON", "r", stdin);
|
||||||
|
}
|
||||||
|
|
||||||
std::string node_indicator;
|
std::string node_indicator;
|
||||||
if (env->GetVar("ATOM_SHELL_INTERNAL_RUN_AS_NODE", &node_indicator) &&
|
if (env->GetVar("ATOM_SHELL_INTERNAL_RUN_AS_NODE", &node_indicator) &&
|
||||||
node_indicator == "1") {
|
node_indicator == "1") {
|
||||||
|
|
Loading…
Reference in a new issue