コード例 #1
0
 /**
  * <summary>
  * Run command with optional arguments from working directory.
  * </summary>
  * <param name="workingDirectory">New process’s working directory.</param>
  * <param name="command">Command for new process.</param>
  * <param name="maybeArguments">Optional command arguments.</param>
  * <returns>Command’s exit code.</returns>
  * <exception cref='S.InvalidOperationException'>No file name was specified in <paramref name="command"/>.</exception>
  * <exception cref='S.ObjectDisposedException'>The process object has already been disposed.</exception>
  * <exception cref='SIO.FileNotFoundException'>The file specified in the <paramref name="command"/> could not be found.</exception>
  * <exception cref='S.ComponentModel.Win32Exception'>
  * <list>
  * <item><description>An error occurred when opening the associated file.</description></item>
  * <item><description>The sum of the length of the arguments and the length of the full path to the process exceeds 2080. The error message associated with this exception can be one of the following: 'The data area passed to a system call is too small.' or 'Access is denied.'</description></item>
  * </list>
  * </exception>
  * <exception cref='S.PlatformNotSupportedException'>Method not supported on operating systems without shell support such as Nano Server (.NET Core only).</exception>
  */
 public ST.Result <STT.Task <ExitCode> > RunCommand(WorkingDirectory workingDirectory, Command command, ST.Maybe <Arguments> maybeArguments)
 => maybeArguments is ST.Just <Arguments>(var arguments)
コード例 #2
0
 /**
  * <summary>
  * Create an exception map for run failures.
  * </summary>
  * <param name="option">The external command options.</param>
  * <param name="maybeArgumentLine">The argument line if any for command.</param>
  * <returns>An exception map from original exception to exception indicating run failure.</returns>
  */
 public static S.Func <S.Exception, ExternalOperationException> GetRunFailureMap(External option, ST.Maybe <string> maybeArgumentLine)
 => (inner)
 => new ExternalOperationException(option, maybeArgumentLine, @"Unable to run external command.", inner);
コード例 #3
0
 ExternalOperationException(External option, ST.Maybe <string> arguments, string message, S.Exception inner) : base(option, message, inner)
 {
     Arguments = arguments;
 }
コード例 #4
0
		public static T FromJust<T>(this ST.Maybe<T> @this)
		where T : object {
			Assert.IsType<ST.Just<T>>(@this);
			return ((ST.Just<T>)@this).Value;
		}
コード例 #5
0
 /**
  * <summary>
  * Get an error stream from environment with default fallback.
  * </summary>
  * <param name="maybeEnvironment">Optional environment.</param>
  * <returns>An error output stream.</returns>
  */
 public static SIO.TextWriter GetErrorStream(ST.Maybe <IEnvironment> maybeEnvironment)
 => maybeEnvironment is ST.Just <IEnvironment>(var environment)
コード例 #6
0
 /**
  * <summary>
  * Output error message to environment.
  * </summary>
  * <param name="this">Error to output.</param>
  * <param name="maybeEnvironment">Optional environment.</param>
  * <param name="maybeConfiguration">Optional configuration.</param>
  * <returns>Task to output error.</returns>
  */
 public static STT.Task DisplayMessage(this S.Exception @this, ST.Maybe <IEnvironment> maybeEnvironment)
 => @this switch
 {