NSTask Class on OS X API , lets you run another program as a subprocess and monitor that program’s execution
Questions tagged [nstask]
459 questions
1
vote
1 answer
Getting mono related Exception while generating build when upgraded to El-capitan
Here is the code by which i am trying to generate build.
NSTask *task=[[NSTask alloc]init];
NSArray *arguments1 = @[@"-v",@"archive",@"-- configuration:AppStore|iPhone",@"/XXX/SimpleTableView.sln"];
[task setArguments:arguments1];
[task…

Ankur jain
- 51
- 4
1
vote
1 answer
How do I wrap up a series of related NSTask operations into discrete functions
I'm writing a Swift command line tool that uses NSTask to interact with git. In the simplest scenario I want to run three commands: init, add ., and commit -m Initial Commit. I intend to use a separate NSTask for each command, and want to house each…

Paul Patterson
- 6,840
- 3
- 42
- 56
1
vote
3 answers
NSTask output special characters convert to UTF8
I'm running lsof through NSTask, pipe output and read into NSData. Then I create NSString with this data:
[[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
Problem I see, is how NSTask interprets special characters. For file with…

Marcel Vyberal
- 101
- 1
- 6
1
vote
0 answers
Error when using killall with NSTask (operation not permitted)
I am trying to kill Finder so it restarts after I make a change using NSTask(). Below is what I am trying to do at the moment in Swift, the problem is I am getting an error and I can't work out how to fix it.
Code:
var task =…

manwholikesspritekit
- 311
- 2
- 12
1
vote
2 answers
NSTask sending an argument through /bin/sh or /bin/bash problem Cocoa Objective-C
Basically I've passed a script in the terminal through /bin/bash "[path]" or /bin/sh "[path]", and I've passed commands in a terminal through /bin/bash -c "[command]" or /bin/sh -c "[command]". Both ways work properly. But in my Cocoa App, when I…

hassaanm
- 14,539
- 4
- 21
- 20
1
vote
1 answer
NSTask setLaunchPath Objective-C Cocca
This is a very simple question. I have a script in the same folder as the Cocoa app. I can't seem to set the path to it properly for setLaunchPath for NSTask. Help please.
I have a folder called Project. Inside of it, exist multiple folders but only…

hassaanm
- 14,539
- 4
- 21
- 20
1
vote
1 answer
run "ls" through NSTask in a Cocoa app not working
I am testing the use of an NSTask because I want to try to run a bunch of commands within my Cocoa application written in Swift that I usually run in Terminal.
In viewDidLoad I have the following code:
let task = NSTask()
let pipe =…

zumzum
- 17,984
- 26
- 111
- 172
1
vote
0 answers
Calling xcodebuild from Swift command line tool fails
I'm writing simple swift command line tool application that automates some of my iOS Dev work. Everything is working except one thing - calling xcodebuild script.
My method looks like this:
func runTest(deviceName: String, os: String) {
…

MichalMoskala
- 887
- 1
- 12
- 25
1
vote
1 answer
How to use NSTask in Swift
I am having a bit of trouble with NSTask() in Swift (for an OS X application). Can someone post a snippet of code in Swift that uses NSTask() correctly? Thank you!

richbrz
- 92
- 8
1
vote
1 answer
Launch Python script from Swift App
I'm new to swift and I'm trying to run a Python file from it.
I already got the full path to the file, and my tries with NStask failed so far.
Now I'm somehow stuck launching the python executable with the path to the script as a parameter :-/ I…

Michael
- 289
- 2
- 5
- 14
1
vote
1 answer
Objective-C: NSCommand "airport -s" returning empty
I'm trying to run airport command to scan my wireless networks. Right now, the approach is to use NSTask. I'm running it as follow:
NSString *command = [NSString…

Marcelo
- 2,075
- 5
- 21
- 38
1
vote
0 answers
How can I prepare arguments for NSTask from UI items
I have a Cocoa app which user is allowed to execute shell commands (just like using Terminal) by entering commands in UI items like NSTextBox. The app allows has a few predetermined parameters which will be converted to certain characters inside the…

albertleng
- 61
- 7
1
vote
1 answer
Command does not return results in SWIFT
I'm trying to run a command line tool and taking the result.
I checked it in terminal:
/usr/bin/exiftool -filename -directory -createdate -model "/Users/dirk/Desktop\" -t -S -q -r -f >"RenamerOutfile0.txt"
This runs fine and delivers result in…

Peter71
- 2,180
- 4
- 20
- 33
1
vote
0 answers
mount_webdav https with NSTask with user credentials
I was trying to mount a webdav share (Windows Server 2008r2) over NSTask. But had no luck.
NSString *server = @"https://domain;username:password@SERVER.tld:443/WDAV";
NSString *mountpoint = @"/Users/me/Desktop/MountPoint";
NSTask *task…

Miralem Cebic
- 1,276
- 1
- 15
- 28
1
vote
0 answers
NSTask Blocking My UI when NSTask encounter large data
I want to update my nstextview with the data generated during nstask execution(Ipa Generation). But when i run my code to execute nstask, in the middle my nstask blocks my ui but the task continues to execute. At last when nstask terminates my ui…

Ankur Jain
- 23
- 5