You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There does not appear to be a means to capture the output stream from Execute-Powershell, nor does it appear possible to obtain the value of a variable set inside the Powershell script back to the enclosing OtterScript.
It is possible to get a result back from $PSEval() but the options to both $PSEval and Execute-Powershell are not equivalent. For instance:
Execute-Powershell uses a Text property which does not interpolate OtterScript variables at the script level (it extracts and dispatches them), which means it better handles the $variables that are specific to the Powershell script
$PSEval()does interpolate OtterScript variables, which means all the variables in the Powershell script have to be backtick-escaped, whether they are specific to the Powershell script or defined in the OtterScript context
$PSEval() does not like parentheses; many of these have to be escaped as well, and it is not always clear which ones
$PSEval() does not like newlines; these can be within "swim" strings, but these still require escaping at least the variables
Correctly escaping all the parentheses and variables in any Powershell longer than a couple of lines is an exercise in torture.
Execute-Powershell is clearly the better choice for more complex scripts, but seems to lack the means to return anything back to the caller.
As such, could Execute-Powershell be at least augmented with an output parameter, to capture anything in the Powershell output stream back to target variable? (noting it would have to be aware of scalar or vector context)
Alternatively/additionally, it would be useful for Execute-Powershell to export variables back to the calling OtterScript context. Clobbering existing variables across the board might not be the right approach (so as not to break existing scripts), but perhaps Execute-Powershell could be given an optional input parameter which is a list of variable names to export, so the capure is opt-in?
(I assume this was the intent of including them in ExecutePowerShellJob+Result, and that Result is corerectly populated...)
We don't monitor our GitHib repos for issues and we have no means of tracking/assigning progress to them internally so, I'm going to close out this issue and try to disable issue tracking.
Can you post this to our fourms instead, where we can track it internally? https://forums.inedo.com/
There does not appear to be a means to capture the output stream from
Execute-Powershell
, nor does it appear possible to obtain the value of a variable set inside the Powershell script back to the enclosing OtterScript.It is possible to get a result back from
$PSEval()
but the options to both$PSEval
andExecute-Powershell
are not equivalent. For instance:Execute-Powershell
uses aText
property which does not interpolate OtterScript variables at the script level (it extracts and dispatches them), which means it better handles the$variables
that are specific to the Powershell script$PSEval()
does interpolate OtterScript variables, which means all the variables in the Powershell script have to be backtick-escaped, whether they are specific to the Powershell script or defined in the OtterScript context$PSEval()
does not like parentheses; many of these have to be escaped as well, and it is not always clear which ones$PSEval()
does not like newlines; these can be within "swim" strings, but these still require escaping at least the variables$PSEval()
is not (currently) particularly supportive of scripts with varying output (see PSEval can be called as $PSEval, @PSEval or %PSEval, but null/empty returns only make sense for $PSEval #25).Correctly escaping all the parentheses and variables in any Powershell longer than a couple of lines is an exercise in torture.
Execute-Powershell
is clearly the better choice for more complex scripts, but seems to lack the means to return anything back to the caller.As such, could
Execute-Powershell
be at least augmented with an output parameter, to capture anything in the Powershell output stream back to target variable? (noting it would have to be aware of scalar or vector context)Alternatively/additionally, it would be useful for
Execute-Powershell
to export variables back to the calling OtterScript context. Clobbering existing variables across the board might not be the right approach (so as not to break existing scripts), but perhapsExecute-Powershell
could be given an optional input parameter which is a list of variable names to export, so the capure is opt-in?(I assume this was the intent of including them in ExecutePowerShellJob+Result, and that
Result
is corerectly populated...)Expand for various crimes against humanity, trying to escape properly
The text was updated successfully, but these errors were encountered: