1using System.Diagnostics;
3using System.Threading.Tasks;
66 if (!(
Arguments[0].AssociatedObjectValue is
string FileName) ||
67 !(
Arguments[1].AssociatedObjectValue is
string Arg) ||
68 !(
Arguments[2].AssociatedObjectValue is
string WorkFolder))
73 ProcessStartInfo ProcessInformation =
new ProcessStartInfo()
77 UseShellExecute =
false,
78 RedirectStandardError =
true,
79 RedirectStandardOutput =
true,
80 WorkingDirectory = WorkFolder,
81 CreateNoWindow =
true,
82 WindowStyle = ProcessWindowStyle.Hidden,
86 Process P =
new Process();
87 TaskCompletionSource<IElement> ResultSource =
new TaskCompletionSource<IElement>();
89 P.ErrorDataReceived += (Sender, e) =>
94 P.Exited += async (Sender, e) =>
100 string ErrorText = await P.StandardError.ReadToEndAsync();
105 string s = await P.StandardOutput.ReadToEndAsync();
111 ResultSource.TrySetException(ex);
115 Task _ = Task.Delay(1000 * 60 * 5).ContinueWith(Prev => ResultSource.TrySetException(
new TimeoutException(
"Process did not exit within the provided time.")));
117 P.StartInfo = ProcessInformation;
118 P.EnableRaisingEvents =
true;
121 return ResultSource.Task;
Script runtime exception.
Class managing a script expression.
Base class for multivariate funcions.
ScriptNode[] Arguments
Function arguments.
static readonly ArgumentType[] argumentTypes3Scalar
Three scalar parameters.
Base class for all nodes in a parsed script tree.
int Length
Length of expression covered by node.
Expression Expression
Expression of which the node is a part.
int Start
Start position in script expression.
ShellExecute(FileName,Arguments,WorkFolder)
ShellExecute(ScriptNode FileName, ScriptNode Arguments, ScriptNode WorkFolder, int Start, int Length, Expression Expression)
ShellExecute(FileName,Arguments,WorkFolder)
override IElement Evaluate(IElement[] Arguments, Variables Variables)
Evaluates the function.
override Task< IElement > EvaluateAsync(IElement[] Arguments, Variables Variables)
Evaluates the function.
override bool IsAsynchronous
If the node (or its decendants) include asynchronous evaluation. Asynchronous nodes should be evaluat...
override string FunctionName
Name of the function
override string[] DefaultArgumentNames
Default Argument names
Basic interface for all types of elements.