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
0
votes
1 answer

Detecting whether a process starts and finishes with notifications in cocoa

I was wondering if there was a way that I could get notifications of when a system process from /usr/sbin starts and finishes. Is it possible to attach NSTask to the running process without launching a new one? Preferably without polling please :!
Alex Zielenski
  • 3,591
  • 1
  • 26
  • 44
0
votes
1 answer

Command Line arguments from a Cocoa App

I know there is a lot of info out there on how to do this, but I was wondering if using NSTask is the best way to call command line arguments from a Cocoa App. Also, if I wanted to use something like "dns-sd ..." (something that doesn't end until…
hassaanm
  • 14,539
  • 4
  • 21
  • 20
0
votes
1 answer

Cocoa - Create multiple instance of my application

My requirement is to create multiple instance of my application. I am able to create multiple instance without argument successfully but as I am passing some argument with my runCommand, it creates infinite instances of my application and to stop…
kulss
  • 2,057
  • 1
  • 14
  • 16
0
votes
1 answer

Xcode Cocoa Objective C Using NSTask to Execute "Find" Shell Command Returns Syntax

I am using Xcode 6.4 trying to execute a find command. The application is a wrapper around the find command. We have a SAN that finder will not search however the find command will search the SAN, I don't wish to discuss the issues with the SAN. I…
Jim Dandy BOA
  • 533
  • 7
  • 13
0
votes
2 answers

Shell script with NSTask doesn't work

I have a command (xcodebuild) that if I try in terminal it works very well. When I try to put it on my code: let xcodeProjectPath = "/Users/xxx/Desktop/Code/xxx.xcworkspace" let xcodeArchivePath = "/Users/xxx/Desktop/xxx.xcarchive" let schemeName =…
user3914418
0
votes
1 answer

Run .saver file from objective c Xcode

I want to upload a screen saver to the app store, after contacting them I was told to encapsulate the .saver inside the .app I want to build a simple .app that launches the .saver which is in its bundle. However I failing to do so :( I tried…
Coldsteel48
  • 3,482
  • 4
  • 26
  • 43
0
votes
0 answers

NSTask appears to terminate early

So I'm using NSTask to run an assembler on a bitcode file using the following code: NSTask *task = [[NSTask alloc] init]; task.launchPath = @"/usr/local/bin/llc"; task.arguments = @[bitcodePath, @"-o", asmPath]; [task launch]; [task…
Slayter
  • 1,172
  • 1
  • 13
  • 26
0
votes
1 answer

Remove Helper Tool using NSTask in MAC Application

I am working on mac application in which I am doing some stuff with root privilege and that is working fine and now I want to delete that Helper Tools so I am trying to delete that helper tool using the NSTask below is the code. NSTask *task =…
Malav Soni
  • 2,739
  • 1
  • 23
  • 52
0
votes
1 answer

NSTask with semaphore in multi-threadeded stuck in waitUntilExit

My Cocoa App has multi threads (up to 8 threads) running a python script using NSTask which takes about 1200 seconds. Almost in every execution of the 8 threads running NSTask, the app just waits almost forever and never returns. I paused the…
0
votes
2 answers

Can NSTask safely be used outside the main thread?

Yesterday I read somewhere that NSTask isn't thread safe and that bothers me a lot, because I'm running a NSTask within a NSThread and is so far not experiencing any threading issues with it. My code is organized like this A: main thread -> B:…
neoneye
  • 50,398
  • 25
  • 166
  • 151
0
votes
1 answer

Terminating suspended NSTask

If I terminate (or interrupt) a suspended NSTask, then it still shows up in activity monitor. It isn't running because the CPU is 0% but it's still taking up memory. Is there a work around?
Jef
  • 1
0
votes
2 answers

Passing extra data to NSTask output handler

I need to read the output of an NSTask. The code from this post achieves this:How to receive output of NSTask in Cocoa?. However, I want to pass in additional data to this function. I tried to create a dictionary and pass that in through the…
Nate
  • 510
  • 1
  • 4
  • 21
0
votes
1 answer

Run adb commands with NSTask

I'm building a simple GUI to run ADB commands in Cocoa. I have found a few different articles saying how to run shell commands using NSTask, but nothing specific to ADB, and I'm having trouble understanding. I can run simple ADB commands, e.g. -…
Thomas
  • 5,810
  • 7
  • 40
  • 48
0
votes
1 answer

Run jar file from swift application with nstask

I'm trying to execute a jar file from my swift application. I use the code bellow: let bundle = NSBundle.mainBundle() let path = bundle.pathForResource("MyJar", ofType: "jar")! let task = NSTask() task.launchPath = "/usr/bin/java" task.arguments =…
Klauss
  • 1
  • 1
  • 3
0
votes
1 answer

SIGTERM when returning NSString

This is my first real Cocoa project. I wrote a function that takes a NSString as input, uses an NSTask to run an ADB command, and returns the terminal output to an NSString. The code builds fine, but when I press the button to run that function, the…
Thomas
  • 5,810
  • 7
  • 40
  • 48