]> khamidou — GitHub mirrors - electron.git/commitdiff
win: Don't attach console for third party terms
authorCheng Zhao <zcbenz@gmail.com>
Thu, 10 Dec 2015 06:37:09 +0000 (14:37 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Thu, 10 Dec 2015 06:37:09 +0000 (14:37 +0800)
Close #3692.

atom/app/atom_main.cc

index 5b5df448dfa8849da94b8dd8d6b043a03c6fa352..1ffab8d9225ae1f8b435ca518bd1600c0affa462 100644 (file)
@@ -7,10 +7,6 @@
 #include <stdlib.h>
 
 #if defined(OS_WIN)
-#include <stdio.h>
-#include <io.h>
-#include <fcntl.h>
-
 #include <windows.h>
 #include <shellscalingapi.h>
 #include <tchar.h>
@@ -56,12 +52,6 @@ bool IsRunAsNode() {
 }
 
 #if defined(OS_WIN)
-bool IsCygwin() {
-  std::string os;
-  scoped_ptr<base::Environment> env(base::Environment::Create());
-  return env->GetVar("OS", &os) && os == "cygwin";
-}
-
 // Win8.1 supports monitor-specific DPI scaling.
 bool SetProcessDpiAwarenessWrapper(PROCESS_DPI_AWARENESS value) {
   typedef HRESULT(WINAPI *SetProcessDpiAwarenessPtr)(PROCESS_DPI_AWARENESS);
@@ -109,7 +99,7 @@ int APIENTRY wWinMain(HINSTANCE instance, HINSTANCE, wchar_t* cmd, int) {
   wchar_t** wargv = ::CommandLineToArgvW(::GetCommandLineW(), &argc);
 
   // Make output work in console if we are not in cygiwn.
-  if (!IsCygwin() && !IsEnvSet("ELECTRON_NO_ATTACH_CONSOLE")) {
+  if (!IsEnvSet("TERM") && !IsEnvSet("ELECTRON_NO_ATTACH_CONSOLE")) {
     AttachConsole(ATTACH_PARENT_PROCESS);
 
     FILE* dontcare;