Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 679741
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T01:17:38+00:00 2026-05-14T01:17:38+00:00

I have been using this as a reference, but not able to accomplish exactly

  • 0

I have been using this as a reference, but not able to accomplish exactly what I need: Calling an external command in Python

I also was reading this: http://www.python.org/dev/peps/pep-3145/

For our project, we have 5 svn checkouts that need to update before we can deploy our application. In my dev environment, where speedy deployments are a bit more important for productivity than a production deployment, I have been working on speeding up the process.

I have a bash script that has been working decently but has some limitations. I fire up multiple ‘svn updates’ with the following bash command:

(svn update /repo1) & (svn update /repo2) & (svn update /repo3) &

These all run in parallel and it works pretty well. I also use this pattern in the rest of the build script for firing off each ant build, then moving the wars to Tomcat.

However, I have no control over stopping deployment if one of the updates or a build fails.

I’m re-writing my bash script with Python so I have more control over branches and the deployment process.

I am using subprocess.call() to fire off the ‘svn update /repo’ commands, but each one is acting sequentially. I try ‘(svn update /repo) &’ and those all fire off, but the result code returns immediately. So I have no way to determine if a particular command fails or not in the asynchronous mode.

import subprocess

subprocess.call( 'svn update /repo1', shell=True )
subprocess.call( 'svn update /repo2', shell=True )
subprocess.call( 'svn update /repo3', shell=True )

I’d love to find a way to have Python fire off each Unix command, and if any of the calls fails at any time the entire script stops.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T01:17:38+00:00Added an answer on May 14, 2026 at 1:17 am

    Don’t use shell=True. It will needlessy invoke the shell to call your svn program, and that will give you the shell’s return code instead of svn’s.

    repos = ['/repo1', '/repo2', '/repo3']
    # launch 3 async calls:
    procs = [subprocess.Popen(['svn', 'update', repo]) for repo in repos]
    # wait.
    for proc in procs:
        proc.wait()
    # check for results:
    if any(proc.returncode != 0 for proc in procs):
        print 'Something failed'
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.