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

OpenSSL - Subject does not start with '/' in OS X application

I'm currently working on an application that collects information from text fields in an OS X application, then access the openssl binary to generate a CSR and a Private Key based on those text fields. Here is the current code let keySizeValue =…
chrono
  • 83
  • 1
  • 8
0
votes
2 answers

NSTask putting extra single quote in command

I'm writing a task to access the OpenSSL binary. If I copy/paste the command without the single quote, then it works perfectly in terminal. I keep pasting the quote into the command. Here is the code / error... let keySizeValue =…
chrono
  • 83
  • 1
  • 8
0
votes
1 answer

NSTask and iOS Swift 2.0

Basically I have a view controller that acts as a setting page. On of the cells calls the "killall backboardd" function to restart the springboard. However since rewriting my app from objective-c to use swift, I found I have ran into some…
ChrisOSX
  • 724
  • 2
  • 11
  • 28
0
votes
2 answers

NSTask (whoami) to string, to NSTask (cp) failed - Swift

I am trying to make a copy of the AddressBook of my Mac to a save place before archiving it. Here is my code : // whoami let whoam : NSTask = NSTask() whoam.launchPath = "/usr/bin/whoami" // pipe whoami|…
Fredo
  • 153
  • 2
  • 13
0
votes
0 answers

Getting Output from NSTask that has Multiple Threads Printing Output

I have an Xcode app (written in Swift, though that should be irrelevant) that starts a console application (i.e. Terminal application that is written in C++) and expects to read the output from its Standard and Error outputs. The task prints from…
P.M.
  • 436
  • 6
  • 12
0
votes
1 answer

How to use NSTask and NSPredicate?

I want to run this command via NSTask: mv /User/xxx.deb /User/Docs To move the deb file to /User/Docs. However, the deb file can have many names: blah.deb, blah3.deb, hgfdo.deb, 6745sdjiz.deb,... Here is my current code: #import…
Ziph0n
  • 197
  • 1
  • 1
  • 7
0
votes
2 answers

Why does an autoreleased NSTask block the runloop on an NSOperation thread indefinitely?

I've run into an while trying to launch an NSTask from inside an NSOperation. Here's a very simple app I've put together to showcase the problem. When you click the button, an NSOperation is queued. It sets up an NSRunLoop, and calls a method which…
texel
  • 194
  • 6
0
votes
0 answers

NSTask with if statement?

I'm not really sure how to phrase this question, but I'll try my best. I have an NSTask that currently unzips an archive, and it needs to also support archives which might have a password. I have no idea how to go about pausing the task or how to…
Yoshi Miro
  • 39
  • 5
0
votes
0 answers

NSTask missing in iOS?

I seems to be unable to use NSTask in iOS. Did anyone else experienced that issue? So I have a simple file: import Foundation var task = NSTask() And I am getting: Use of unresolved identifier 'NSTask' Anyone experiencing similar or same issue? If…
Jakub Zak
  • 1,212
  • 6
  • 32
  • 53
0
votes
1 answer

Creating a GUI for a command-line utility using Cocoa

I'm looking for a way to create a GUI (using Cocoa) to make a command-line utility more accessible to some of my colleagues. If you use NSTask to execute/start the utility, can you then simply use another NSTask to execute the next command (using…
Bart Jacobs
  • 9,022
  • 7
  • 47
  • 88
0
votes
0 answers

Piping to awk fails to output from Swift 2.0

I'm trying to run the following command to process the output via Swift 2.0 but I'm having trouble doing so. netstat -w1 -I en | awk '{ print $3 }' The command runs as expected when ran manually from the terminal. I tried the method of calling…
chrisdwheatley
  • 127
  • 1
  • 10
0
votes
1 answer

Executing C++ binary using Objective C. Getting "cannot execute binary file"

I have written a Objective C module that invokes a C++ binary file. I am using NSTask for that. Code snippet is below. bool filePathExists; NSFileManager *fileManager = [[NSFileManager alloc] init]; NSString *filePath =…
JMD
  • 337
  • 4
  • 16
0
votes
1 answer

NSTask Until Interrupted Command in Cocoa / Objective-C

I am trying to use NSTask on to run an ASR Multicast Stream, a Ruby Server Script, etc. Basically, I'm trying to run tasks with NSTask that do not finish running until interrupted, but the problem is that I can't get the NSTask to run in the…
hassaanm
  • 14,539
  • 4
  • 21
  • 20
0
votes
1 answer

Cocoa NSTask help

I need a bit of help with NSTask. Also, I am new to Cocoa / Obj-C programming, so please bear with me. I am trying to make a directory. Then, remove it. So here is what I have so far: NSLog (@"START"); NSTask *task; task = [[NSTask alloc]…
hassaanm
  • 14,539
  • 4
  • 21
  • 20
0
votes
2 answers

Opening OS X Apple Maps with specific coordinates from Cocoa command line tool

I am trying to launch the native Maps app and show a specific coordinate in OS X from my command line tool. I've found three options: Use [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:url]]; Use the open command and pass a formatted…
Can Poyrazoğlu
  • 33,241
  • 48
  • 191
  • 389