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

  • SEARCH
  • Home
  • 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 4608294
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T00:49:29+00:00 2026-05-22T00:49:29+00:00

I need to run multiple commands in sequence using NSTask and was wondering what

  • 0

I need to run multiple commands in sequence using NSTask and was wondering what would be a good way to tell if a task has finished so I can continue on to the next command. I’m using “sox” (which I am including in my application bundle) to create temporary audio files using input audio files, and then need to combine those temporary audio files into a single file. An example of the flow of processes (not the actual commands):

1) songA > tempA

2) songB > tempB

3)combine tempA tempB > songC

I’m using the following code to complete the first command:

    NSArray *arguments;
    arguments = [NSArray arrayWithObjects: @"songA", @"-f", @"-S", @"-G", @"-V", @"-b", @"24", @"-r", @"384k", @"tempA", nil];

        NSString *path=[[NSBundle mainBundle] pathForResource:@"sox" ofType:nil];

        NSTask *task;
        task = [[NSTask alloc] init];

        [task setStandardInput:[NSPipe pipe]]; 

        [task setLaunchPath:path];

        [task setArguments: arguments1];

        NSPipe *pipe;
        pipe = [NSPipe pipe];
        [task setStandardOutput: pipe];

        NSFileHandle *file;
        file = [pipe fileHandleForReading];

        [task launch];

        NSData *data;
        data = [file readDataToEndOfFile];

        NSString *string;
        string = [[NSString alloc] initWithData: data encoding: NSUTF8StringEncoding];

        NSLog (@"stuff  :\n%@", string);

        [string release];
        [task release];

Suppposing I needed to perform two more NSTask processes after this one had finished (using the output of the previous processs), what would be the best way to detect that one process has finished so that I can continue on to the next one.

Thanks.

  • 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-22T00:49:30+00:00Added an answer on May 22, 2026 at 12:49 am

    Maybe not understand fully, but

    [task waitUntilExit];
    

    does not do the job?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Requirement: I need to run multiple animations one by one. I'm using onAnimationEnd() to
I need my application run in multiple screen resolutions. Currently I have specified all
Do I need to have separate/multiple workers to run multiple websites (each with a
How to I run multiple threads in VB.NET? Say I need 2 threads -
I need to run an executable JAR file in multiple threads/cores. The JAR file
I am using the .NET 2.0/3.5 framework for my application. I need to run
I need to implement an application that is simultaneously communicating with multiple clients using
I would like to execute multiple commands in a row: i.e. (just to illustrate
Hi i have been using an IDE but now I need to run and
I'm trying to run various commands with net:ssh2 however the commands need to be

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.