-
Notifications
You must be signed in to change notification settings - Fork 1
/
call-powershell.red
83 lines (68 loc) · 1.67 KB
/
call-powershell.red
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
Red [
Title: "call-powershell.red"
Builds: [
0.0.0.1.3 {Initial version}
]
Iterations: [
4 {Refactoring of unless value? '.to-powershell
commenting:
; unless silent [
; print powershell-command
; ]
}
]
]
.call-powershell: function[
.powershell-command
/out /silent
/_build
/_debug
][
unless value? '.to-powershell [
if error? try [
do load-thru/update https://redlang.red/to-powershell.red
][
if error? try [
do load-thru https://redlang.red/to-powershell.red
print "internet connection error, loaded from cache"
][
print "internet connection error, cannot load from cache"
]
]
]
if _build [
Builds: [
0.0.0.1.5 {Debug message}
]
]
if _debug [
do https://redlang.red/do-trace
]
if _debug [
do-trace 41 [
?? .powershell-command
] %call-powershell.5.red
]
powershell-command: .to-powershell .powershell-command
;print powershell-command
if _debug [
do-trace 43 [
?? powershell-command
] %call-powershell.5.red
]
either not out [
call powershell-command
][
output: copy ""
unless value? '.do-events [
do https://redlang.red/do-events.red
]
.do-events/no-wait
call/output powershell-command output
unless silent [
print output
]
return output
]
]
call-powershell: :.Call-Powershell