[Cocoa] NSTask Help

Discussion in 'Mac Programming' started by jlegend, Dec 3, 2008.

  1. jlegend macrumors newbie

    Joined:
    Dec 3, 2008
    #1
    I want to run a shell script I wrote, but I'm having some trouble figuring it out. this is my code so far.

    Code:
    NSString *crackPath = [[NSBundle mainBundle] pathForResource:@"shell" ofType:@"sh"];
        [NSString addFileWithPath:shellPath];
        
        [outPipe release];
        [inPipe release];
        [task release];
        
        outPipe = [[NSPipe alloc] init];
        inPipe = [[NSPipe alloc] init];
        task = [[NSTask alloc] init];
        
        [task setLaunchPath:shellPath];
        
        [task setStandardOutput:outPipe];
        [task setStandardInput:inPipe];
        
        
        [task launch];
    
     
  2. Catfish_Man macrumors 68030

    Catfish_Man

    Joined:
    Sep 13, 2001
    Location:
    Portland, OR
    #2
    What's the [NSString addFileWithPath:shellPath]; bit supposed to do?
     
  3. jlegend thread starter macrumors newbie

    Joined:
    Dec 3, 2008
    #3
    its suppose to make the shellPath a file
     
  4. Krevnik macrumors 68030

    Krevnik

    Joined:
    Sep 8, 2003
    #4
    Well, the question I have is: does this even compile? That doesn't look like a valid method call at all.

    shellPath is defined where?
     
  5. Catfish_Man macrumors 68030

    Catfish_Man

    Joined:
    Sep 13, 2001
    Location:
    Portland, OR
    #5
    Check the documentation for NSString. No such class method exists.
     

Share This Page