2 from abc
import abstractmethod
8 from threading
import Thread
12 """Specialization for a desktop platform."""
14 def __init__(self, exe_path):
20 """Return execution path of DesktopService."""
24 def _get_output(self, output, error):
28 """Set _exe_path to a new path.
30 The parameter exe_path is a string representing the path for the
33 self._exe_path = exe_path
36 """Start a new process for the _exe_path and starts solving
38 class MyThread(Thread):
39 def __init__(self, start_sync):
44 callback.callback(self.
start_sync(programs, options))
49 def start_sync(self, programs, options):
50 """Start a new process for the _exe_path and starts solving
55 option += o.get_options()
56 option += o.get_separator()
58 print(
"Warning : wrong " +
65 final_program += p.get_programs()
66 for path
in p.get_files_paths():
68 files_paths.append(path)
70 print(
"Warning : wrong " +
74 return Output(
"",
"Error: executable not found")
83 for path
in files_paths:
88 print(exep +
" ", end=
'')
90 print(opt +
" ", end=
'')
91 for path
in files_paths:
92 print(path +
" ", end=
'')
93 if final_program !=
"":
98 start = int(time.time() * 1e+9)
100 proc = subprocess.Popen(
102 universal_newlines=
True,
103 stdout=subprocess.PIPE,
104 stderr=subprocess.PIPE,
105 stdin=subprocess.PIPE,
108 output, error = proc.communicate(final_program)
110 end = int(time.time() * 1e+9)
112 print(
"Total time : " + str(end - start))