Esempio n. 1
0
        /// <summary>
        /// Check to see what kind of device we are outputting the log to, is it a character device, a file, or something else
        /// this can be used by loggers to modify their outputs based on the device they are writing to
        /// </summary>
        internal void IsRunningWithCharacterFileType()
        {
            // Get the std out handle
            IntPtr stdHandle = NativeMethodsShared.GetStdHandle(NativeMethodsShared.STD_OUTPUT_HANDLE);

            if (stdHandle != Microsoft.Build.BackEnd.NativeMethods.InvalidHandle)
            {
                uint fileType = NativeMethodsShared.GetFileType(stdHandle);

                // The std out is a char type(LPT or Console)
                runningWithCharacterFileType = (fileType == NativeMethodsShared.FILE_TYPE_CHAR);
            }
            else
            {
                runningWithCharacterFileType = false;
            }
        }