Skip to content

Commit 55a360d

Browse files
authored
Merge pull request #26 from vinayvennela/#issue25_return_PID_of_launched_application
Update __init__.py to return PID of the launched application using "Run" keyword
2 parents c13fad9 + 2619c19 commit 55a360d

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/AutoItLibrary/__init__.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -288,22 +288,29 @@ def Run(self, FileName, WorkingDir="", Flag="") :
288288
289289
This is required in order to do error code translation into exceptions for Robot Framework.
290290
"""
291+
#
292+
# Capture the PID of the launched process and return
293+
#
294+
application_pid = None
291295
self._infoKW(self.Run, FileName, WorkingDir, Flag)
292296

293297
if WorkingDir == "" and Flag == "" :
294298
cmd = "FileName='%s'" % FileName
295-
self._AutoIt.Run(FileName)
299+
application_pid = self._AutoIt.Run(FileName)
296300
elif WorkingDir != "" and Flag == "" :
297301
cmd = "FileName='%s', WorkingDir='%s'" % (FileName, WorkingDir)
298-
self._AutoIt.Run(FileName, WorkingDir)
302+
application_pid = self._AutoIt.Run(FileName, WorkingDir)
299303
else :
300304
cmd = "FileName='%s', WorkingDir='%s', Flag='%s'" % (FileName, WorkingDir, Flag)
301-
self._AutoIt.Run(FileName, WorkingDir, Flag)
305+
application_pid = self._AutoIt.Run(FileName, WorkingDir, Flag)
302306
#
303307
# Check the AutoIt error property
308+
# If no error then return the PID of the launched application
304309
#
305310
if self._AutoIt.error == 1 :
306311
raise Exception("Failed to run %s" % cmd)
312+
else:
313+
return application_pid
307314
#
308315
#-------------------------------------------------------------------------------
309316
#

0 commit comments

Comments
 (0)