Пример #1
0
        } // func type

        /// <summary></summary>
        /// <param name="program"></param>
        /// <param name="mode"></param>
        /// <returns></returns>
        public LuaFile popen(string program, string mode = "r")
        {
            string sFileName;
            string sArguments;

            LuaLibraryOS.SplitCommand(program, out sFileName, out sArguments);
            ProcessStartInfo psi = new ProcessStartInfo(sFileName, sArguments);

            psi.RedirectStandardOutput = mode.IndexOf('r') >= 0;
            psi.RedirectStandardInput  = mode.IndexOf('w') >= 0;
            psi.UseShellExecute        = false;
            psi.CreateNoWindow         = true;
            return(new LuaFile(Process.Start(psi), psi.RedirectStandardOutput, psi.RedirectStandardInput));
        } // func popen
Пример #2
0
        /// <summary></summary>
        /// <param name="program"></param>
        /// <param name="mode"></param>
        /// <returns></returns>
        public LuaFile popen(string program, string mode = "r")
        {
            string fileName;
            string arguments;

            LuaLibraryOS.SplitCommand(program, out fileName, out arguments);

            var psi = new ProcessStartInfo(fileName, arguments);

            psi.RedirectStandardOutput = mode.IndexOf('r') >= 0;
            if (psi.RedirectStandardOutput)
            {
                psi.StandardOutputEncoding = defaultEncoding;
            }
            psi.RedirectStandardInput = mode.IndexOf('w') >= 0;
            psi.UseShellExecute       = false;
            psi.CreateNoWindow        = true;

            return(new LuaFileProcess(Process.Start(psi), psi.RedirectStandardOutput, psi.RedirectStandardInput));
        }         // func popen