Python Forum
Program-launching script will not close until the program it launches is closed
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Program-launching script will not close until the program it launches is closed
#2
As described, you can't, because when a process exits, all its child processes are killed.

So the trick is therefore to have the new process started by the desktop process, which remains up until the user logs off. IIRC in Windows this is what the START command does, so you would use, if start is a distinct executable:
run_argList = ["start","C:\\Program Files\\LibreOffice 5\\program\\scalc.exe",saveFileName]
or if start is a built-in command to cmd.exe 
run_argList = ["cmd.exe","/c" "start","C:\\Program Files\\LibreOffice 5\\program\\scalc.exe",saveFileName]
in which cas you can likely simplify this to:
run_argList = ["cmd","/c" "start","scalc",saveFileName]
and let cmd.exe figure out what/where scalc is.

Btw, you can divide by two the wear of your backslash key in several ways:
  1. use a "raw" string specification by prefixing the string with r
    r"C:\Program Files\LibreOffice 5\program\scalc.exe"
  2. use a "raw" string specification by using triple quotes
    '''C:\Program Files\LibreOffice 5\program\scalc.exe'''
  3. learning that Windows is perfectly happy with forward slashes(only the CMD.EXE argument parser doesn't like them)
    'C:/Program Files/LibreOffice 5/program/scalc.exe'
    (of course if you use cmd.exe in the call above you can't use that form, but you normally don't need the path).
Unless noted otherwise, code in my posts should be understood as "coding suggestions", and its use may require more neurones than the two necessary for Ctrl-C/Ctrl-V.
Your one-stop place for all your GIMP needs: gimp-forum.net
Reply


Messages In This Thread
RE: Program-launching script will not close until the program it launches is closed - by Ofnuts - Jun-21-2017, 10:31 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  kill python execution program lebossejames 0 186 Mar-16-2024, 11:16 AM
Last Post: lebossejames
  Unexpected termination of program when using JDBC drivers in python with jaydebeapi skarface19 2 255 Feb-17-2024, 12:01 PM
Last Post: skarface19
  This result object does not return rows. It has been closed automatically dawid294 5 688 Jan-10-2024, 10:55 PM
Last Post: deanhystad
  Basic Coding Question: Exit Program Command? RockBlok 3 504 Nov-19-2023, 06:31 PM
Last Post: deanhystad
  how come i can't stop program Shi_Shi_Shi_Shi 4 564 Nov-16-2023, 06:20 PM
Last Post: deanhystad
  Using Autostart to run a GUI program at startup. Rpi Edward_ 1 577 Oct-28-2023, 03:19 PM
Last Post: SpongeB0B
  Program to find Mode of a list PythonBoy 6 1,000 Sep-12-2023, 09:31 AM
Last Post: PythonBoy
Question Using SQLAlchemy, prevent SQLite3 table update by multiple program instances Calab 3 704 Aug-09-2023, 05:51 PM
Last Post: Calab
  program needs this plugins robertkwild 1 448 Aug-09-2023, 04:33 PM
Last Post: deanhystad
  Help with flowchart maker program bluebouncyball 2 733 Aug-08-2023, 10:25 PM
Last Post: deanhystad

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020