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

Blocking standard out from a NSTask-run program

I am using NSTask with setStandardOutput to redirect the standard output of a command line tool to my program, so I can use it for processing. This works great but as a side result the tool's output gets shown as output when I run my program. I want…
Locksleyu
  • 5,192
  • 8
  • 52
  • 77
0
votes
1 answer

iTunes isRunning with NSTask

So I am trying to make an if based on if iTunes is running or not. I need this because my application gets the track name. This track name has already been accomplished and works but I do not want iTunes always running... So I decided to try a…
Andrew Sheridan
  • 19
  • 1
  • 10
-1
votes
1 answer

Command line tool running slowly from NSTask but fast from Terminal

I have written a cmdline tool that usually takes 15-20 seconds to finish. While it performs its task, it outputs its progress at least once per second via stdout. When I run the command from Terminal.app, it performs as fast as possible, e.g. within…
Thomas Tempelmann
  • 11,045
  • 8
  • 74
  • 149
-1
votes
1 answer

Executing shell script FILE with NSTask - Objective-C

i've got a file "Script.sh", which includes different shell commands, like some defaults write or creating folders, moving files etc. For Example: #!/bin/sh defaults write com.apple.finder AppleShowAllFiles -bool TRUE killall Finder However, im…
samecat
  • 335
  • 1
  • 11
-1
votes
2 answers

stderr not being redirected to variable when bash script run from NSTask/Process in Swift

Edit: Here is a link to the actual Xcode Test Project: https://github.com/briggsm/StdErrTest With this, I think it will be very easy to reproduce & see this issue. Original Post: I have an executable (chmod +x) bash script (myScript.sh) like…
briggsm
  • 455
  • 3
  • 15
-1
votes
1 answer

Running a command on a remote machine over SSH using NSTask fails

I'm trying to use the techniques from this answer to run a command on a remote machine over SSH, and collect the output. This is my code: dispatch_async(dispatch_queue_create("closet ping", NULL), ^{ NSTask *task; task = [[NSTask alloc]…
Undo
  • 25,519
  • 37
  • 106
  • 129
-2
votes
1 answer

Call shell script using objective-c - NsTask

I have been working on a command line tool in swift but due to excessive size of the executable(around 10 mb) I need to re-write it in objective-c. Now I am not a fan of objective-c, thanks to it's lengthy syntax. So I have this function which I…
SUMIT NIHALANI
  • 387
  • 1
  • 10
-3
votes
1 answer

Swift NStask function

I'm a complete swift noob. Using this code in xcode I get the result I need. I created a command line binary "menubar" that takes several arguments. I normally run it in the terminal "/bin/menubar getip", "/bin/menubar/getuser". I want to create a…
nyitguy
  • 598
  • 4
  • 18
-4
votes
1 answer

Translating AppleScript to Objective-C

I am new to Objective-C and I am trying to translate an AppleScript into Objective-C. Using AStranslate, I get the error Untranslated event 'sysoexec' The following is the applescript I want to translate: do shell script…
1 2 3
30
31