Python Forum
SOLVED: best way to block (wait on) shell calls to multiple windows programs at once?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
SOLVED: best way to block (wait on) shell calls to multiple windows programs at once?
#1
EDIT: turns out start (in windows) has a /wait option, which i can append to solve this. ive known start longer than ive known python, but i didnt know about that option.


so i have this program, and im happy to post the source but its quite large (it has function calls that are literally 1000 loc distance from the defintion) and im not looking for someone to fix the code; im looking for practical design advice.

what the code (already) does is:

* get a list of files piped into stdin.

* get sys.argv[2] ([1] is already used for something else) as a string

* run sys.argv[2] + " " + (each line of stdin) using os.system

i know, you want me to use subprocess. thats fine. heres my question though:


if you are a very silly and pipe 1000 filenames to this feature, and then say give it windows notepad as the second command line argument...

its going to open 1000 instances of notepad.

if you do the same thing with leafpad in gnu/linux, youre ok! because the shell wont continue until leafpad closes.

but windows wont block the loop, so it will just keep opening more notepads.

i can think of one really easy fix for this, i bet you can too, the only reason im putting this question here is:

...have you got a better idea than the one thats easy to think of? im open to advice here.

and yes, i know, i should be using subprocess. that doesnt address the question though, because (as far as i know) subprocess wont fix this UNLESS you can tell me how it would, actually-- please do feel free to explain how.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  [SOLVED] [Windows] Fails reading strings with accents Winfried 1 823 Apr-23-2023, 05:27 PM
Last Post: Larz60+
  [SOLVED] [Windows] Right way to prompt for directory? Winfried 4 2,040 Jan-17-2023, 09:28 PM
Last Post: markoberk
  Multiple.ui windows showing at the same time when I only want to show at a time eyavuz21 4 1,018 Dec-20-2022, 05:14 AM
Last Post: deanhystad
  python multiple try except block in my code -- can we shorten code mg24 10 6,097 Nov-10-2022, 12:48 PM
Last Post: DeaD_EyE
  [SOLVED] [Windows] Converting filename to UTF8? Winfried 5 2,548 Sep-06-2022, 10:47 PM
Last Post: snippsat
  Wait til a date and time KatManDEW 2 1,418 Mar-11-2022, 08:05 PM
Last Post: KatManDEW
  wait for the first of these events Skaperen 4 1,934 Mar-07-2022, 08:46 PM
Last Post: Gribouillis
  how to do a two-way wait Skaperen 2 1,258 Mar-04-2022, 02:31 AM
Last Post: Skaperen
  batch file for running python scipt in Windows shell MaartenRo 2 1,884 Jan-21-2022, 02:36 PM
Last Post: MaartenRo
Thumbs Up [SOLVED] Simplify condition test in if block? Winfried 2 1,710 Aug-25-2021, 09:42 PM
Last Post: Winfried

Forum Jump:

User Panel Messages

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