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
1
vote
1 answer

NSTask node --version not working

I'm using NSTask in xcode to try and find the version of node js the computer is using. Here's my code: NSString *runCommand(NSString *commandToRun) { NSTask *task; task = [[NSTask alloc] init]; [task setLaunchPath: @"/bin/bash"]; NSArray…
1
vote
1 answer

Getting process output using NSTask on-the-go?

I'd like to get NSTask output as soon as it appears not waiting until process finishes. I've found this answer but how it should be modified to get data ASAP? I think i should run background thread and wait for output all the time somehow.
4ntoine
  • 19,816
  • 21
  • 96
  • 220
1
vote
3 answers

Saving System Profiler info in a .spx file using NSTask

In Cocoa, I am trying to implement a button, which when the user clicks on will capture the System profiler report and paste it on the Desktop. Code NSTask *taskDebug; NSPipe *pipeDebug; taskDebug = [[NSTask alloc] init]; [[NSNotificationCenter…
cocoacoder
  • 381
  • 8
  • 19
1
vote
1 answer

Program structure regarding NSTask

I want to run an unknown amount (unknown at compile time) of NSTasks and I want to run an unknown amount (again, at compile time, max. 8) of them simultaneously. So basically I loop through a list of files, generate an NSTask, run it until the…
Jef
  • 297
  • 5
  • 15
1
vote
1 answer

NSFileManager or NSTask moving filetypes

I've been struggling to find a solution to do what should be a very simple task. I need to move a certain type of file (all zip files in this case) into another directory. I've tried NSTask and NSFileManager but have come up empty. I can move one at…
Rory Zipher
  • 245
  • 1
  • 2
  • 10
1
vote
1 answer

Check if an NSTask is creating files

I am executing an executable in Cocoa using NSTask. The executable is creating files. Is there any way I can find out which files are created by this executable during its execution ? Thanks.
Laurent Crivello
  • 3,809
  • 6
  • 45
  • 89
1
vote
1 answer

Git bundled into Cocoa app cannot find helpers in bundle

Context: I have a Mac app. I want to include Git in this app because some functions of my app use Git and I don't want the user to have to install it on his machine. I have downloaded Git from source. I edited the Makefile to declare these two…
Bryan
  • 4,628
  • 3
  • 36
  • 62
1
vote
0 answers

Cocoa - Launching a child process?

What is the best method to use for launching a child process? Namely, I want to launch a webview for a limited time - due to memory usage I'd like to run this as a child process. Is NSTask suitable for this? And how does one specify that one app…
user429620
1
vote
1 answer

OS X NSTask error 22

I am building a simple package on OS X using pkgbuild that consists of a folder of stuff and the pre/postinstall scripts. When I try to execute the resulting package, the installer fails with the following message in the log: Nov 1 13:28:11…
1
vote
2 answers

NSTask does not send termination notification

I have registered for a NSTaskDidTerminateNotification of a NSTask object. Everything works fine, but the task takes time to launch so i've moved the launching to background (with performSelectorInBackground). the registration with notification…
Marius
  • 3,976
  • 5
  • 37
  • 52
1
vote
1 answer

Read an endless output with nstask

Ok, here comes my problem. I have a program that tells me the value of a sensor, this program runs in a terminal and the output is just like that: 110 362 492 655 and so on....indefinitely with a rate of 4 lines (status) per second. Then i need to…
1
vote
2 answers

Ignoring user input while waiting for a task - Objective-C

I have an app with a button 'convert'. When I click this button, the app starts a new process using NSTask and then greys out the button until the process finishes. My problem is, the app saves any clicks made by the user while it is waiting for the…
Vlad the Impala
  • 15,572
  • 16
  • 81
  • 124
1
vote
2 answers

How to unzip file via terminal in Objective-c

I want to unzip the file via terminal on Mac instead of using ZipArchive or SSZipArchive. In terminal, I tried "unzip" command and it works good, but I do not how to express via objective c code. I've tried this way (link: Unzip without prompt) It…
YU FENG
  • 888
  • 1
  • 12
  • 29
1
vote
1 answer

Open URL (.mp4) in QuickTime (Cocoa App for OSX)

I would like to open QuickTime and play a remote file. I use the following code: NSTask *task = [[NSTask alloc] init]; [task setLaunchPath:@"/usr/bin/open"]; [task setArguments:[NSArray arrayWithObjects: @"/Applications/QuickTime Player.app",…
user1756209
  • 573
  • 10
  • 23
1
vote
2 answers

Hide an application on launch when invoked using NSTask

I'm launching an application using NSTask and using NSPipe to get it's stdout and stderr. I'd like to hide it (the GUI) on launch, as the app just does some commands and exits. I can't use NSWorkspace since I need stdout/stderr. Does anyone know of…
Patrick Pijnappel
  • 7,317
  • 3
  • 39
  • 39