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

Unjaring a .jar file in Objective-C

I was wondering if it was possible to extract the contents of a .jar file into a different directory, then add some files to that directory, and then compress the directory back into a .jar file, with the additions. A way of extracting the jar file…
GravityScore
  • 385
  • 1
  • 3
  • 13
1
vote
2 answers

Is it possible to set an NSTask-owned window front and key?

I'm working on a Mac app that will optionally provide the ability to install some extra software that's in apple package format. This package requires elevated (root) privileges to install, and instead of bothering with a helper tool or…
joraff
  • 967
  • 6
  • 15
1
vote
0 answers

Pseudo TTY in Obj-C

Currently I am working on developing a GUI to some command line tools for Jailbroken iOS devices. I am using NSTask and verified that I was able to capture both stdout and stderr error and print the output to a UITextField. How ever most of the…
Trcx
  • 4,164
  • 6
  • 30
  • 30
1
vote
1 answer

Send value from NSTextField to constantly running NSTask

There have been a couple of NSTask related questions, but after paging through them I still have no idea what to do. I'm writing a frontend for a java server in Cocoa, launched by java -Xmx1024M -Xms1024M -jar server.jar nogui (I've left out the…
citelao
  • 4,898
  • 2
  • 22
  • 36
1
vote
1 answer

NSTask start/stop

I'm currently trying to start NSTask on button click and stop it on another button click (two buttons). Can anybody tell my how to do that? Thanks, Greets Julian
Julian F. Weinert
  • 7,474
  • 7
  • 59
  • 107
1
vote
1 answer

NSTask to NSString compare don't work

I'm currently trying to compare a shell output to a string. But it won't work at all! StringOne = [[NSString alloc] initWithData:dataTwo encoding:NSUTF8StringEncoding]; if([StringOne isEqualToString:@"get if addr en0 failed, (os/kern) failure"]) { …
Julian F. Weinert
  • 7,474
  • 7
  • 59
  • 107
1
vote
1 answer

Swift CLI: run process, display its output and allow user input

I've been trying for some days now to find and equivalent to Ruby's exec in Swift. I haven't yet been able to find a solution. Multiple sources online suggest how to forward predefined input to STDIN of the child process and out to read its output,…
dvkch
  • 1,079
  • 1
  • 12
  • 20
1
vote
2 answers

How to include an external executable into a MacOS app?

I am building a simple app with a TextField input. I want to pass the input of the TextField to a cli tool I built with Golang. This cli-tool is not sitting in /usr/bin but under ~/go/bin in my user directory. So, when I try something like the…
1
vote
1 answer

Run terminal command with NSTask

I want to run a Terminal command in my program. The command looks like this: cd /path/to/file/; ./foo HTTPProxy 127.0.0.1 It works with system() but it doesn't work when I use NSTask. system("cd /path/to/file/; ./foo HTTPProxy 127.0.0.1"); works…
ahee
  • 13
  • 3
1
vote
1 answer

Detect Whether Mac Has MagSafe Charging Port Programmatically, Or Detect If USB-C Port Exists

I'm trying to figure out a way to determine whether a Mac has a MagSafe charging port programmatically. If that's not possible, alternatively, I suppose detecting whether any USB-C ports exist (and thus MagSafe is not present). I've searched around…
1
vote
2 answers

Zip from command line - how to trim path elements

I'm executing a zip command from within my app using NSTask. It's passed as arguments some paths which point to the files/folders to be zipped. The problem is that without the -j option, the final zip ends up with absurd filepaths inside the zip,…
SG1
  • 2,871
  • 1
  • 29
  • 41
1
vote
1 answer

How can one get the subprocesses of an NSTask's process?

If I use an NSTask object which is launched, is it possible to get the process invoked by the task? For example, Terminal does this to show it in the title bar: How can I get the process invoked by the NSTask's process?
user142019
1
vote
1 answer

Determine which signal uncaught by terminated child process

I have a Mac OS X app (Cocoa), which spawns a C++ console helper app to do some work. The GUI spawns the helper via NSTask, and they communicate with each other via named pipes. This is all good. If the helper app dies, the GUI gets an…
zpasternack
  • 17,838
  • 2
  • 63
  • 81
1
vote
1 answer

Create NSTask for gdb

I'm trying to create an NSTask that uses GDB to attach to a program, but my program just freezes after launching the task. Is this possible to do? Here is the code I'm using: NSTask *task = [NSTask new]; [task…
cdever
  • 41
  • 1
1
vote
0 answers

Swift iOS: dyld: dyld_sim cannot be loaded in a restricted process

I'm making an iOS app for jailbroken devices running iOS 12 or newer. I need my app to run a command line command, so to achieve that I use a custom Objective-C header file which creates the object NSTask and everything it needs, and then, using…
amodrono
  • 1,900
  • 4
  • 24
  • 45