-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathiris_ipm.py
More file actions
41 lines (34 loc) · 777 Bytes
/
iris_ipm.py
File metadata and controls
41 lines (34 loc) · 777 Bytes
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
def ipm(cmd, *args):
"""
Executes shell command with IPM:
Parameters
----------
cmd : str
The command to execute
Examples
--------
`ipm('help')`
`ipm('load /home/irisowner/dev -v')`
`ipm('install webterminal')`
"""
import multiprocessing
def shell(cmd, status):
import iris
status.put(True)
res = iris.cls("%IPM.Main").Shell(cmd)
print('')
if res != 1:
status.get()
status.put(False)
manager = multiprocessing.Manager()
status = manager.Queue()
process = multiprocessing.Process(
target=shell,
args=(
cmd,
status,
),
)
process.start()
process.join()
return status.get()