Questions tagged [nstask]

NSTask Class on OS X API , lets you run another program as a subprocess and monitor that program’s execution

459 questions
3
votes
1 answer

How to get "continous" terminal execution output in a Cocoa app?

To ask elsehow: When I clone a git repo for example, terminal output goes like: Cloning into '/users/whatever'... remote: Counting objects: 1764, done. remote: Compressing objects: 100% (909/909), done. remote: Total 1764 (delta 944), reused 1622…
Geri Borbás
  • 15,810
  • 18
  • 109
  • 172
3
votes
1 answer

How do i make a GIT credential helper?

The original question has been edited for clarity: I have a main project that does a git clone https://my.repo.project.git. The project has 2 targets (main target and password helper target). The repository is password protected and will ask for…
Just a coder
  • 15,480
  • 16
  • 85
  • 138
3
votes
2 answers

NSTask vs System - pros and cons?

I'm at a point in a project where I need to call system commands. I originally started looking at NSTask (as that seems to be the most popular approach) but recently i just came across the system command. It looks like a far easier setup that…
Just a coder
  • 15,480
  • 16
  • 85
  • 138
3
votes
6 answers

Working around NSFileHandle NSTask blocking when passing large amounts of data

I've got a bit of code that handles exporting data from my application. It takes in an NSString full of XML and runs it through a PHP script to generate HTMl, RTF, etc. It works well unless a user has a large list. This is apparently due to it…
Justin Williams
  • 703
  • 1
  • 9
  • 26
3
votes
1 answer

NSTask requires flush when reading from a process' stdout, Terminal does not

I have a simple Python script that asks for your name, then spits it back out: def main(): print('Enter your name: ') for line in sys.stdin: print 'You entered: ' + line Pretty simple stuff! When running this in the OS X Terminal,…
Craig Otis
  • 31,257
  • 32
  • 136
  • 234
3
votes
1 answer

Objective-C, running NSTask in background periodically

I've seen some good information on how to keep an NSTask running in the background, although that's not entirely what I want to do. What I would like to do is periodically run an NSTask in the the background (like every 30 seconds), then kill it;…
Joe Habadas
  • 628
  • 8
  • 21
3
votes
0 answers

NSTask does not receive stdout outside of Xcode 4.3.3

this is my first post, so let me send me many thanks to all the posting guys outside there (I use SO extensively passively - great!) I'm working on an video exporting tool for Mac OS X using the good old Quicktime API. Brief: I cut frames from…
Mat Col
  • 31
  • 2
3
votes
2 answers

Piping NSTask's output directly to a file?

What's the best way to directly pipe an NSTask's output to a file? I want to go through as few buffers in memory as possible.
Anonymous
  • 1,750
  • 3
  • 16
  • 21
3
votes
1 answer

How to to run separate processes on iOS

How can I run a separate process (the executable will be in the main bundle) on iOS? NSTask seems to be missing... BTW I don't care if this will be rejected by Apple, as it will never be submitted.
cfischer
  • 24,452
  • 37
  • 131
  • 214
3
votes
2 answers

NSTask with multiple pipe input

I'm trying to use pipes to handle a command that requires multiple inputs, but not quite sure how to do it. Here's a snippet of what I'm trying to do. I know how to handle the first input, but I'm at lost as to piping in the second input…
Daniel
  • 648
  • 1
  • 8
  • 14
2
votes
2 answers

Async execution of shell command not working properly

So, this is my code : - (void)runCmd:(NSString *)cmd withArgs:(NSArray *)args { NSLog(@"\nRunning ::\n\tCmd : %@\n\tArgs : %@",cmd, args); [theSpinner start]; if (task) { [task interrupt]; } else { task =…
Dr.Kameleon
  • 22,532
  • 20
  • 115
  • 223
2
votes
4 answers

Is there any way to run two or more NSTasks?

You can run a script in a Cocoa application using the wonderful NSTask, and it works great. The only issue is that I need to run multiple scripts, and in my application, the scripts cannot be combined into one file or one call -- they must be run as…
Jeff Escalante
  • 3,137
  • 1
  • 21
  • 30
2
votes
3 answers

How to run a shell command in cocoa and get output?

After repeated searching I have not found an elegant solution to this issue: how to run a shell command in obj-c and get it's output. I have read many questions regarding this, but they all fail to answer my question. Some get the exit value (…
Trcx
  • 4,164
  • 6
  • 30
  • 30
2
votes
3 answers

NSTask and arguments when running command line tools

How would I pass arguments (host in this case) to NSTask in this code? It does not accept the host NSString. If I pass the host value with the ping, for e.g.. [NSArray arrayWithObjects:@"-c",@"ping -c 5 www.google.com",nil] then it works. But it…
ZionKing
  • 326
  • 1
  • 4
  • 16
2
votes
3 answers

NSTask only returning standardError in release build

First of all, when debugging and running in Xcode everything works as expected. But when I try to "share" my app, i.e. make a release build, my NSTask won't output any standardOutput while standardErrors ARE put out. How is that possible? My code -…
ThomasM
  • 2,647
  • 3
  • 25
  • 30