Re: NSTask Open Word File

2016-08-12 Thread Jens Alfke
> On Aug 11, 2016, at 6:20 PM, Gurkan Erdogdu wrote: > > Hi folks > In my Swift application, I try to open a Word file with Microsoft Word > application via NSTask. To add to what Charles said: NSTask is only for running command-line tools or other non-GUI binaries. Don’t

Re: NSTask Open Word File

2016-08-11 Thread Charles Srstka
> On Aug 11, 2016, at 5:20 PM, Gurkan Erdogdu wrote: > > Hi folks > In my Swift application, I try to open a Word file with Microsoft Word > application via NSTask. Here is the code: > let task = NSTask() > task.launchPath = b

Re: Ending NSTask doesn't release file handle opened by the task it wraps.

2016-07-21 Thread Graham Cox
> On 22 Jul 2016, at 9:22 AM, Uli Kusterer wrote: > > On 21 Jul 2016, at 17:20, Graham Cox wrote: >> One of my apps uses NSTask to wrap a command line utility that is embedded >> in the same app’s resources. This utility writes files to disk - I have no >> knowled

Re: Ending NSTask doesn't release file handle opened by the task it wraps.

2016-07-21 Thread じょいすじょん
> On 22 Jul 2016, at 8:22, Uli Kusterer wrote: > > On 21 Jul 2016, at 17:20, Graham Cox wrote: >> One of my apps uses NSTask to wrap a command line utility that is embedded >> in the same app’s resources. This utility writes files to disk - I have no >> knowledge

Re: Ending NSTask doesn't release file handle opened by the task it wraps.

2016-07-21 Thread Uli Kusterer
On 21 Jul 2016, at 17:20, Graham Cox wrote: > One of my apps uses NSTask to wrap a command line utility that is embedded in > the same app’s resources. This utility writes files to disk - I have no > knowledge of which APIs it uses to do this. If the task has ended (and I can >

Re: Ending NSTask doesn't release file handle opened by the task it wraps.

2016-07-21 Thread Daniel Stenmark
Do you have any NSPipes or NSFileHandles set on the NSTask’s I/O channels? (standardOutput, standardError, and standardInput) Dan > On Jul 21, 2016, at 8:20 AM, Graham Cox wrote: > > One of my apps uses NSTask to wrap a command line utility that is embedded in > the same app

Re: Ending NSTask doesn't release file handle opened by the task it wraps.

2016-07-21 Thread Jens Alfke
That’s strange. I would use the `lsof` tool to figure out which process has that file open. You can also use `fs_usage` while the tool is running to monitor all the filesystem activity on that file. —Jens ___ Cocoa-dev mailing list (Cocoa-dev@lists.ap

Ending NSTask doesn't release file handle opened by the task it wraps.

2016-07-21 Thread Graham Cox
One of my apps uses NSTask to wrap a command line utility that is embedded in the same app’s resources. This utility writes files to disk - I have no knowledge of which APIs it uses to do this. If the task has ended (and I can see that the actual instance of the running command line tool has

Re: NSTask argument list

2016-06-26 Thread Graham Cox
I was able to set a readability handler on a NSPipe, set as stdout for the NSTask. ffmpeg has a -progress option which spews a bit of easily-parsed text to the pipe, so I was able to extract the info I wanted from that. All pretty straightforward in the end. —Graham __

Re: NSTask argument list

2016-06-26 Thread Sandor Szatmari
from the ffmpeg documentation - is there a way to get feedback from the > ffmpeg tool while it’s running, via NSTask? It writes a log to stderr, and > there are settings to control how verbose that is, but it would be necessary > to parse the text output to look for specific things.

Re: NSTask argument list

2016-06-25 Thread Sandor Szatmari
Graham, > On Jun 25, 2016, at 23:37, Graham Cox wrote: > > HI all, > > I am using NSTask to wrap ffmpeg, the video conversion utility. > > I am able to invoke ffmpeg alright, but it’s unclear how the argument list > should be passed through NSTask. I tried making m

Re: NSTask argument list

2016-06-25 Thread Graham Cox
and array and the tool is separate. Yep, it makes perfect sense, and is a good fit for my needs. A follow up question, but this may be something that I’ll just have to grok from the ffmpeg documentation - is there a way to get feedback from the ffmpeg tool while it’s running, via NSTask? It writ

Re: NSTask argument list

2016-06-25 Thread dangerwillrobinsondanger
If it helps, you can think of it as an object oriented wrapped around C system calls that keeps track of PID and all the other bits like stdout and so on. That helps to grok why the args is and array and the tool is separate. Sent from my iPhone > On Jun 26, 2016, at 1:37 PM, Graham Cox wrot

Re: NSTask argument list

2016-06-25 Thread Graham Cox
Ah thanks Marco, Andy… this makes a lot more sense and works fine. —Graham > On 26 Jun 2016, at 2:30 PM, Marco S Hyman wrote: > I believe arguments is an array of arguments, not an array containing a > string that matches a command line. > > Then your arguments array should contain five item

Re: NSTask argument list

2016-06-25 Thread Marco S Hyman
> > NSString* argString = [NSString stringWithFormat:@"-i \"%@\" -c copy > %@", [url absoluteString], [self.outputFileURL absoluteString]]; > > self.ffMPEGTask = [NSTask launchedTaskWithLaunchPath:execPath > arguments:@[argString]

Re: NSTask argument list

2016-06-25 Thread Andy Lee
if I were at my desk rather than on my phone. --Andy On Sat, Jun 25, 2016, at 11:37 PM, Graham Cox wrote: > HI all, > > I am using NSTask to wrap ffmpeg, the video conversion utility. > > I am able to invoke ffmpeg alright, but it’s unclear how the argument > list should

NSTask argument list

2016-06-25 Thread Graham Cox
HI all, I am using NSTask to wrap ffmpeg, the video conversion utility. I am able to invoke ffmpeg alright, but it’s unclear how the argument list should be passed through NSTask. I tried making my various arguments into one big string, but ffmeg doesn’t parse it, instead writing an error

Re: How to terminate an NSTask whenever my app terminates?

2015-09-01 Thread Jens Alfke
> On Aug 31, 2015, at 11:44 PM, Bavarious wrote: > > There was a 2010 cocoa-dev thread about this: > http://www.lists.apple.com/archives/cocoa-dev/2010/Aug/msg00512.html > Yes, this seems to be what I’m looking for — settin

Re: How to terminate an NSTask whenever my app terminates?

2015-09-01 Thread Scott Ribe
On Aug 31, 2015, at 10:55 PM, Ken Thomases wrote: > > Try the following program. The parent will print the child's PID and exit > (by falling out of main()). Then do a "ps xww -p ". You'll > see the child is still running. You can kill it when satisfied. Yep, I got it backwards. Nothing sp

Re: How to terminate an NSTask whenever my app terminates?

2015-08-31 Thread Bavarious
> On Aug 31, 2015, at 20:32, Jens Alfke wrote: > > (I know this has come up here before, but I can’t get the right combination > of search terms to find an answer…) > > I’m writing a little GUI wrapper app around a command-line-based server. It > uses NSTask to launch

Re: How to terminate an NSTask whenever my app terminates?

2015-08-31 Thread Ken Thomases
On Aug 31, 2015, at 9:50 PM, Scott Ribe wrote: > > Normally, when a parent exits, all child processes are killed. This is not true. > This is not specific to terminal/tty sessions. Yes, it is. Try the following program. The parent will print the child's PID and exit (by falling out of main(

Re: How to terminate an NSTask whenever my app terminates?

2015-08-31 Thread Michael David Crawford
On the UNIX command line "nohup" prevents children from being killed when the parent exits. If you want to manually start a daemon: $ nohup mydaemon & Then you can log out and it keeps running. -- Michael David Crawford P.E., Consulting Process Architect mdcrawf...@gmail.com http://mike.so

Re: How to terminate an NSTask whenever my app terminates?

2015-08-31 Thread Scott Ribe
Normally, when a parent exits, all child processes are killed. This is not specific to terminal/tty sessions. However, a process can be detached from its parent so that it will survive the parent's exit. I doubt that NSTask does this, but you should verify. Create a dummy helper: int

Re: How to terminate an NSTask whenever my app terminates?

2015-08-31 Thread Doug Hill
n > of search terms to find an answer…) > > I’m writing a little GUI wrapper app around a command-line-based server. It > uses NSTask to launch the server. I want to ensure that when the app exits, > the server process exits too. I can tell the NSTask to terminate in my app > deleg

How to terminate an NSTask whenever my app terminates?

2015-08-31 Thread Jens Alfke
(I know this has come up here before, but I can’t get the right combination of search terms to find an answer…) I’m writing a little GUI wrapper app around a command-line-based server. It uses NSTask to launch the server. I want to ensure that when the app exits, the server process exits too

Re: NSTask & pseudo-TTY troubles

2015-03-01 Thread SevenBits
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 02/25/2015 04:15 PM, Kyle Sluder wrote: > On Wed, Feb 25, 2015, at 01:15 PM, SevenBits wrote: >> Here’s an example of the session when output is printed (notice >> the echoing): >> >> Insane BF Interactive Console 1.0 (Dec 18 2014, 16:22:05) Curren

NSTask & pseudo-TTY troubles

2015-02-26 Thread SevenBits
back along with output. If I disable echoing, then this does not happen, but then strangely enough certain aspects of the terminal stop working. Here’s how I setup the TTY, done as a category on top of NSTask: - (NSFileHandle *)masterSideOfPTYOrError:(NSError *__autoreleasing *)error

Re: NSTask & pseudo-TTY troubles

2015-02-25 Thread Kyle Sluder
On Wed, Feb 25, 2015, at 01:15 PM, SevenBits wrote: > Here’s an example of the session when output is printed (notice the > echoing): > > Insane BF Interactive Console 1.0 (Dec 18 2014, 16:22:05) > Current memory size: 3 cells, each 4 bytes > : , > , > A > A > > : > : . > . > A > : > > And h

NSTask & pseudo-TTY troubles

2015-02-25 Thread SevenBits
back along with output. If I disable echoing, then this does not happen, but then strangely enough certain aspects of the terminal stop working. Here’s how I setup the TTY, done as a category on top of NSTask: - (NSFileHandle *)masterSideOfPTYOrError:(NSError *__autoreleasing *)error

terminationHandler of NSTask delayed

2014-11-01 Thread Gerriet M. Denkmann
App with NSTimer, which periodically starts an NSTask, which has a terminationHandler. Sometimes (no idea how to trigger this) the terminationHandlers do NOT get executed when the task terminates. Only when I make my app active, a whole bunch of them will - but not in the correct order. Is

Re: NSTask: how to launch a binary as if I launched it via terminal?

2014-04-14 Thread Colas
Thanks to everyone for helping !!! Using setEnvironment made it easily. I was looking for a complicated solution when the solution was not so difficult. Le 14 avr. 2014 à 17:59, Colas a écrit : > Thanks also for the idea of -setEnvironment. I will try.

Re: NSTask: how to launch a binary as if I launched it via terminal?

2014-04-14 Thread Colas
écrit : > Colas, > > If my previous code snippet doesn’t work with pdflatex, NSTask has a > -setEnvironment method; it may allow you to set your task’s environment > variables. > > — > Bryan Vines > > > On Apr 14, 2014, at 10:40 AM, Colas wrote: > >

Re: NSTask: how to launch a binary as if I launched it via terminal?

2014-04-14 Thread Colas
much !! Le 14 avr. 2014 à 17:43, Bryan Vines a écrit : > Colas, > > If my previous code snippet doesn’t work with pdflatex, NSTask has a > -setEnvironment method; it may allow you to set your task’s environment > variables. > > — > Bryan Vines > > > On Apr 14

Re: NSTask: how to launch a binary as if I launched it via terminal?

2014-04-14 Thread Colas
Le 14 avr. 2014 à 17:07, Bryan Vines a écrit : > Hi Colas, > > Pico is an interactive text editor. I don’t think NSTask is going to give you > much opportunity to interact with it. Are you using Pico as an example, or > are you actually trying to launch Pico? > > If yo

Re: NSTask: how to launch a binary as if I launched it via terminal?

2014-04-14 Thread Bryan Vines
Colas, If my previous code snippet doesn’t work with pdflatex, NSTask has a -setEnvironment method; it may allow you to set your task’s environment variables. — Bryan Vines On Apr 14, 2014, at 10:40 AM, Colas wrote: > My problem is that I want to launch pdflatex with the -shell-esc

Re: NSTask: how to launch a binary as if I launched it via terminal?

2014-04-14 Thread Bryan Vines
Colas, Bash’s -c option expects commands in a string which follows. Therefore, this will work: I’m using /usr/bin/touch as an example, rather than your example of pico, which is an interactive text editor. NSTask * myTask = [[NSTask alloc]init]; NSArray * arguments = @[@&qu

Re: NSTask: how to launch a binary as if I launched it via terminal?

2014-04-14 Thread Colas
> Try putting > > /usr/bin/pico /Users/colas/myfile.txt > > into separate items in the argument NSArray. I find the man page ambiguous, > and I lack direct experience, but that may be what bash expects. > > It is not working, unfortunately. > I can’t guarantee that this will solve the large

Re: NSTask: how to launch a binary as if I launched it via terminal?

2014-04-14 Thread Ken Thomases
the window. This is no simple thing. In fact, it's very complex. It's not what NSTask does and, in fact, no built-in part of Cocoa does it for you. It will be much, much simpler to simply load the file into a text view, let the user edit it that way, and save it back. If you want the

Re: NSTask: how to launch a binary as if I launched it via terminal?

2014-04-14 Thread Fritz Anderson
known. > > Thanks! > Le Lundi 14 avril 2014 16h19, Jerry Krinock a écrit : > > From documentation of -[NSTask setArguments:] : > > "The strings in arguments do not undergo shell expansion, so you do not need > to do special quoting” > > I don’t know what they me

Re: NSTask: how to launch a binary as if I launched it via terminal?

2014-04-14 Thread Colas B
documentation of -[NSTask setArguments:] : "The strings in arguments do not undergo shell expansion, so you do not need to do special quoting” I don’t know what they mean by “special”, but anyhow, the ‘ ' you put around your last argument will be passed to your tool and cause

Re: NSTask: how to launch a binary as if I launched it via terminal?

2014-04-14 Thread Bryan Vines
Colas, Do you want your app to open a Terminal window, in which Pico has opened the file at /Users/colas/myfile.txt? If that’s so, I don’t think launching it via NSTask is going to get you anything. What is the end result you want to achieve? — Bryan Vines On Apr 14, 2014, at 8:59 AM, Colas B

Re: NSTask: how to launch a binary as if I launched it via terminal?

2014-04-14 Thread Jerry Krinock
From documentation of -[NSTask setArguments:] : "The strings in arguments do not undergo shell expansion, so you do not need to do special quoting” I don’t know what they mean by “special”, but anyhow, the ‘ ' you put around your last argument will be passed to your tool and cause

NSTask: how to launch a binary as if I launched it via terminal?

2014-04-14 Thread Colas B
Dear cocoa-dev, I am would like to launch a binary as if I launched it via terminal. I tried the following but it is not working.      NSTask * myTask = [[NSTask alloc] init];     NSArray * arguments = @[@"-c", @"-l", @"'/usr/bin/pico /Users/col

Re: NSTask: program launching another program, potential problem with path: how to do?

2014-04-10 Thread Keary Suska
On Apr 10, 2014, at 3:34 PM, Colas B wrote: > I am not an unix-ey guy... > > I don't specify explicitly a bash when I run my program (with NSTask) : I > just give the path to the program. If I discover the path to the shell being > used, does it mean that what used

Re: NSTask: program launching another program, potential problem with path: how to do?

2014-04-10 Thread Scott Ribe
On Apr 10, 2014, at 4:09 PM, Colas B wrote: > No, it is "Mach-O 64-bit executable" Then there is no shell run when you execute it via NSTask. Really, the correct answer is that pdflatex should not depend on a relative or hard-coded path for gnuplot. (It's fine of cours

Re : Re: NSTask: program launching another program, potential problem with path: how to do?

2014-04-10 Thread Colas B
No, it is "Mach-O 64-bit executable" ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your

Re: NSTask: program launching another program, potential problem with path: how to do?

2014-04-10 Thread Jens Alfke
On Apr 10, 2014, at 2:34 PM, Colas B wrote: > I don't specify explicitly a bash when I run my program (with NSTask) : I > just give the path to the program. It sounds like the program you’re telling NSTask to run is a shell-script. You can easily verify that by using the ‘file’

Re : Re: NSTask: program launching another program, potential problem with path: how to do?

2014-04-10 Thread Colas B
I am not an unix-ey guy... I don't specify explicitly a bash when I run my program (with NSTask) : I just give the path to the program. If I discover the path to the shell being used, does it mean that what used to be the path of my NSTask will become an argument?About path and enviro

Re: NSTask: program launching another program, potential problem with path: how to do?

2014-04-10 Thread Keary Suska
tead use the first approach I mention. > Le Jeudi 10 avril 2014 16h32, Jens Alfke a écrit : > > On Apr 10, 2014, at 6:23 AM, Keary Suska wrote: > >> This is more likely a shell scripting issue, rather than am NSTask issue, >> unless sandboxing is somehow interfering,

Re: NSTask: program launching another program, potential problem with path: how to do?

2014-04-10 Thread Jens Alfke
On Apr 10, 2014, at 1:52 PM, Colas B wrote: > Your idea sounds good. What can I do if I want both shells invoked from > programs and login shells to have the same initialization script? I think it’s better to make sure your login-shell setup script (.bash_profile or .login) doesn’t have thing

Re: NSTask: program launching another program, potential problem with path: how to do?

2014-04-10 Thread Colas B
is pdflatex (with the -shell-escape option) and myauxprogram is gnuplot. Colas Le Jeudi 10 avril 2014 16h32, Jens Alfke a écrit : On Apr 10, 2014, at 6:23 AM, Keary Suska wrote: This is more likely a shell scripting issue, rather than am NSTask issue, unless sandboxing is somehow

Re: NSTask: program launching another program, potential problem with path: how to do?

2014-04-10 Thread Jens Alfke
On Apr 10, 2014, at 6:23 AM, Keary Suska wrote: > This is more likely a shell scripting issue, rather than am NSTask issue, > unless sandboxing is somehow interfering, and you are obscuring the issue by > not telling us at least how myprogram is locating myauxprogram. The most

Re: NSTask: program launching another program, potential problem with path: how to do?

2014-04-10 Thread Keary Suska
On Apr 10, 2014, at 6:57 AM, Colas B wrote: > Dear cocoa-dev, > > I want to do with an `NSTask` what I am able to do in the terminal via > > $ myprogram myfile.ext > > I know that `myprogram` (I don't have any control on this program) launches > another progra

NSTask: program launching another program, potential problem with path: how to do?

2014-04-10 Thread Colas B
Dear cocoa-dev, I want to do with an `NSTask` what I am able to do in the terminal via     $ myprogram myfile.ext I know that `myprogram` (I don't have any control on this program) launches another program `myauxprogram`. Furthermore, the path to `myprogram` is `path1` and the pa

Re: NSTask for external tool - keep active/prevent relaunch?

2014-03-08 Thread Scott Ribe
On Mar 7, 2014, at 11:24 PM, Trygve Inda wrote: > The issue is that the > time spent launching the tool is vastly more then doing the tool's work... Are you sure about that??? Just because time is spent in the "launch" method doesn't prove that. You might want to sample (or spindump) everything

Re: NSTask for external tool - keep active/prevent relaunch?

2014-03-07 Thread Trygve Inda
es to be passed on the command line. Check their man pages. > > But running those from NSTask shouldn’t be any slower than doing it from > something like a shellscript. > > (BTW, MD5 digests are trivial to compute using the APIs in > . There’s no need to launch a tool to do that.

Re: NSTask for external tool - keep active/prevent relaunch?

2014-03-07 Thread Jens Alfke
k their man pages. But running those from NSTask shouldn’t be any slower than doing it from something like a shellscript. (BTW, MD5 digests are trivial to compute using the APIs in . There’s no need to launch a tool to do that. And to digress further, MD5 isn’t very secure; it’s better to use S

Re: NSTask for external tool - keep active/prevent relaunch?

2014-03-07 Thread Trygve Inda
>There is, but, first of all, why does this external tool terminate? > What is it? I'd like it to work with md5, ffmpeg and others. These all work fine, but quit after returning their data. T. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.co

Re: NSTask for external tool - keep active/prevent relaunch?

2014-03-07 Thread Jerry Krinock
On 2014 Mar 07, at 18:04, Trygve Inda wrote: > My app sometimes needs to call an external tool that runs via NSTask and > delivers text output back to my app. I profiled it and most of the time > (30%) is spent in [NSConcreteTask launchWithDictionary] > > Is there any techniq

NSTask for external tool - keep active/prevent relaunch?

2014-03-07 Thread Trygve Inda
My app sometimes needs to call an external tool that runs via NSTask and delivers text output back to my app. I profiled it and most of the time (30%) is spent in [NSConcreteTask launchWithDictionary] Is there any technique I can use to keep this running and thus not have to relaunch it the next

Re: NSTask and 10.9 [SOLVED]

2013-11-27 Thread Kyle Sluder
> On Nov 27, 2013, at 7:59 AM, koko wrote: > > NSString *scriptPath = [[NSBundle mainBundle] pathForResource:@"DeleteHidden" > ofType:nil]; > > NSTask *task; > task = [[NSTask alloc] init]; > [task setLaunchPath:scriptPath]; > > The script DeleteHid

Re: NSTask and 10.9 [SOLVED]

2013-11-27 Thread koko
NSString *scriptPath = [[NSBundle mainBundle] pathForResource:@"DeleteHidden" ofType:nil]; NSTask *task; task = [[NSTask alloc] init]; [task setLaunchPath:scriptPath]; The script DeleteHidden had line endings of which caused an exception on 10.9 removing the via a hex editor re

Re: NSTask and 10.9

2013-11-26 Thread Ken Thomases
On Nov 26, 2013, at 9:47 AM, koko wrote: > NSTask *task; > task = [[NSTask alloc] init]; > [task setLaunchPath:rootScriptPath]; > [task setArguments:[NSArray arrayWithObjects:rootpath, nil]]; > [task waitUntilExit]; > [task launch]; > [task release]; You have the invo

Re: NSTask and 10.9

2013-11-26 Thread Kyle Sluder
known-good path to -setLaunchPath: causes the same symptoms. > > so do you know if Mavericks disallows NSTask access to the App Bundle? > Perhaps. Starting in Mavericks, all the binaries within a signed bundle must be themselves signed before the bundle is signed, because their signatures

Re: NSTask and 10.9

2013-11-26 Thread Pax
So: NSFileManager *fileMgr = [NSFileManager defaultManager]; NSArray *contents = [fileMgr contentsOfDirectoryAtPath: error:nil]; for (NSString *item in contents) { if ([item rangeOfString:].location !=NSNotFound) { [

Re: NSTask and 10.9

2013-11-26 Thread Scott Ribe
On Nov 26, 2013, at 9:42 AM, koko wrote: > > On Nov 26, 2013, at 8:56 AM, Pax <45rpmli...@googlemail.com> wrote: > >> hy would you delete files in this manner? > > Need to wildcard the file names. Get the directory contents and look for matches, or use glob. -- Scott Ribe scott_r...@eleva

Re: NSTask and 10.9

2013-11-26 Thread koko
On Nov 26, 2013, at 8:56 AM, Pax <45rpmli...@googlemail.com> wrote: > hy would you delete files in this manner? Need to wildcard the file names. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator com

Re: NSTask and 10.9

2013-11-26 Thread Pax
; } You already know what paths you need to use… I hope that this helps. On 26 Nov 2013, at 15:47, koko wrote: > I need to remove hidden files from removable media and have been doing so > successfully until 10.9. > > I use NSTask as follows: > > NSTask *ta

Re: NSTask and 10.9

2013-11-26 Thread Kyle Sluder
On Tue, Nov 26, 2013, at 07:47 AM, koko wrote: > This works just fine up to and including 10.8.5 BUT throws an exception > at [task launch] on 10.9 What is the exception? --Kyle Sluder ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do

NSTask and 10.9

2013-11-26 Thread koko
I need to remove hidden files from removable media and have been doing so successfully until 10.9. I use NSTask as follows: NSTask *task; task = [[NSTask alloc] init]; [task setLaunchPath:rootScriptPath]; [task setArguments:[NSArray arrayWithObjects:rootpath, nil]]; [task waitUntilExit

Re: Non-sandboxed Cocoa app accessing current user preferences using NSTask fails when launched outside Xcode.

2013-07-27 Thread Scott Ribe
On Jul 27, 2013, at 2:58 AM, Robert Vojta wrote: > What I want to say - you never know if they'll be approved, so, it's better > to avoid them and try to find another solution. OK. Whereas by "you can do this" I meant, I added the entitlement with my explanation and it was approved. But in my

Re: Non-sandboxed Cocoa app accessing current user preferences using NSTask fails when launched outside Xcode.

2013-07-27 Thread Robert Vojta
> > On 26. 7. 2013, at 21:36, Jens > > I've never worked with sandboxing, but I would guess that a sandboxed app > can't access arbitrary files in ~/Library/Preferences They can't. Sandboxed apps have own containers in ~/Library/Containers/$BUNDLEID/Data/Library/Preferences ... You can ask f

Re: Non-sandboxed Cocoa app accessing current user preferences using NSTask fails when launched outside Xcode.

2013-07-26 Thread Scott Ribe
f, I didn't notice that you said "non-sandboxed". The biggest difference between being launched under Xcode and launched from the Finer, in terms of questions to this list from confused devs, is the default working directory. Check your paths. Check the path of the prefs file you want

Re: Non-sandboxed Cocoa app accessing current user preferences using NSTask fails when launched outside Xcode.

2013-07-26 Thread Scott Ribe
On Jul 26, 2013, at 9:35 PM, Public wrote: > This experience has definitely piqued my curiosity about the difference in > "access rights" of an app launched from within Xcode. I would expect > difference in app behavior for an iOS app launched on device versus > simulator, but am baffled by th

Re: Non-sandboxed Cocoa app accessing current user preferences using NSTask fails when launched outside Xcode.

2013-07-26 Thread Public
Thanks Scott and Jens for sharing your thoughts. I didn't set up entitlements (yet), but when launched from within Xcode, my (non-sandboxed Cocoa) app was able to read and clear ~/Library/Preferences/com.apple.LaunchServices.QuarantineEventsV2 created by system. However, when launched from Fi

Re: Non-sandboxed Cocoa app accessing current user preferences using NSTask fails when launched outside Xcode.

2013-07-26 Thread Scott Ribe
On Jul 26, 2013, at 1:36 PM, Jens Alfke wrote: > I've never worked with sandboxing, but I would guess that a sandboxed app > can't access arbitrary files in ~/Library/Preferences, but instead has to go > through NSUserDefaults. Don't know about iOS, but at least on OS X you can do this, depend

Re: Non-sandboxed Cocoa app accessing current user preferences using NSTask fails when launched outside Xcode.

2013-07-26 Thread Jens Alfke
On Jul 23, 2013, at 12:10 PM, Paul Scott wrote: > Why launch sqlite command? Why not link directly to the sqlite library and > access the data base directly? +1. You can also use the open-source FMDB library, a friendly Objective-C wrapper around SQLite. I've never worked with sandboxing, bu

Re: Non-sandboxed Cocoa app accessing current user preferences using NSTask fails when launched outside Xcode.

2013-07-25 Thread Paul Scott
wrote: I've a non-sandboxed Cocoa app that launches sqlite command using NSTask to read a preferences file in ~/Library/Preferences. The app works fine when launched using Xcode Build-and-Run, but when the app (after using Xcode Archive and Distribute) is launched independent of Xcode, th

Re: Non-sandboxed Cocoa app accessing current user preferences using NSTask fails when launched outside Xcode.

2013-07-25 Thread Paul Scott
wrote: > I've a non-sandboxed Cocoa app that launches sqlite command using NSTask to > read a preferences file in ~/Library/Preferences. The app works fine when > launched using Xcode Build-and-Run, but when the app (after using Xcode > Archive and Distribute) is launched ind

Re: NSTask interrupt exception

2013-07-25 Thread Martin Hewitson
Scott, Thanks for your detailed message. This lead me to search for -interrupt calls and I found one on another NSTask. I was assuming that this typesetting task was the issue, but maybe it's really this other task. My biggest problem is that I've never managed to reproduce the

Re: NSTask interrupt exception

2013-07-25 Thread Scott Ribe
On Jul 25, 2013, at 8:24 AM, Martin Hewitson wrote: > Dear list, > > I have a couple of users reporting exceptions (and crashes) which I think are > associated with my interrupting an NSTask when they close a document. I get > exceptions like this: > > *** -[NSConcrete

NSTask interrupt exception

2013-07-25 Thread Martin Hewitson
Dear list, I have a couple of users reporting exceptions (and crashes) which I think are associated with my interrupting an NSTask when they close a document. I get exceptions like this: *** -[NSConcreteTask interrupt]: task not launched In the code I do the following to cancel the NSTask

Re: Non-sandboxed Cocoa app accessing current user preferences using NSTask fails when launched outside Xcode.

2013-07-24 Thread Robert Martin
… or give fmdb a try - https://github.com/ccgus/fmdb rob > On 2013 Jul 23, at 10:04, Public wrote: > >> If you need sqlite, your time would be better spent learning to link the >> sqlite library directly and use sqlite's C interface. ___ Cocoa-d

Re: Non-sandboxed Cocoa app accessing current user preferences using NSTask fails when launched outside Xcode.

2013-07-24 Thread Jerry Krinock
On 2013 Jul 23, at 10:04, Public wrote: > I've googled and searched StackOverflow and they suggest I read Authorization > Services Programming Guide. Ignore that. This is more likely an NSTask issue, not an authorization issue. > My question is: if the sqlite command is to be

Re: Non-sandboxed Cocoa app accessing current user preferences using NSTask fails when launched outside Xcode.

2013-07-23 Thread Todd Heberlein
> I've a non-sandboxed Cocoa app that launches sqlite command using NSTask to > read a preferences file in ~/Library/Preferences. The app works fine when > launched using Xcode Build-and-Run, but when the app (after using Xcode > Archive and Distribute) is launched independent

Non-sandboxed Cocoa app accessing current user preferences using NSTask fails when launched outside Xcode.

2013-07-23 Thread Public
I've a non-sandboxed Cocoa app that launches sqlite command using NSTask to read a preferences file in ~/Library/Preferences. The app works fine when launched using Xcode Build-and-Run, but when the app (after using Xcode Archive and Distribute) is launched independent of Xcode, th

Re: Parental Controls - [Was: NSTask Explodes. Clueless.]

2013-05-12 Thread Seth Willits
On May 12, 2013, at 6:47 PM, Ken Thomases wrote: > On May 12, 2013, at 8:08 PM, Seth Willits wrote: > >> The user running my main application has parental controls enabled. The user >> is allowed to run the main application, and can, but the helper task that is >> bundled inside the main applic

Re: Parental Controls - [Was: NSTask Explodes. Clueless.]

2013-05-12 Thread Ken Thomases
On May 12, 2013, at 8:08 PM, Seth Willits wrote: > The user running my main application has parental controls enabled. The user > is allowed to run the main application, and can, but the helper task that is > bundled inside the main application's bundle is not allowed to run. When the > *task*

Parental Controls - [Was: NSTask Explodes. Clueless.]

2013-05-12 Thread Seth Willits
der? Any ideas what to do? -- Seth Willits On Feb 4, 2013, at 11:26 AM, Seth Willits wrote: > > In my app I have to launch background processes (bundled within my app's > Resources folder) to do some things, and I launch them with NSTask. Every now > and then I get a crash

Re: Understanding NSTask

2013-04-10 Thread Torsten Curdt
> Torsten Curdt! Coincidentally, I've been studying your asynctask.m for the > last day, and just pushed to my github an updated (ARC, etc.) NSTask wrapper, > based on it… > > https://github.com/jerrykrinock/ClassesObjC/blob/master/SSYTasker.h Nice :) Glad the old cod

Re: Understanding NSTask

2013-04-09 Thread Jerry Krinock
nd just pushed to my github an updated (ARC, etc.) NSTask wrapper, based on it… https://github.com/jerrykrinock/ClassesObjC/blob/master/SSYTasker.h "A wrapper around NSTask which runs a task synchronously, as in -[NSTask waitUntilExit], but is more robust" __

Re: Understanding NSTask

2013-04-09 Thread Uli Kusterer
On 08.04.2013, at 13:59, Rui Henriques Pacheco wrote: > I'm currently going through all available literature on Google on using > NSTask to open SSH tunnels. While I have running code I'm not sure I > understand everything that's happening. > > First, NSTask exec

Re: Understanding NSTask

2013-04-08 Thread Torsten Curdt
, 2013 at 1:59 PM, Rui Henriques Pacheco wrote: > Hi, > > I'm currently going through all available literature on Google on using > NSTask to open SSH tunnels. While I have running code I'm not sure I > understand everything that's happening. > > First, NSTas

Understanding NSTask

2013-04-08 Thread Rui Henriques Pacheco
Hi, I'm currently going through all available literature on Google on using NSTask to open SSH tunnels. While I have running code I'm not sure I understand everything that's happening. First, NSTask executes SSH as a subprocess. Then why is this blocking the main thread? --

Re: NSTask arguments

2013-02-20 Thread Ken Thomases
On Feb 20, 2013, at 10:31 PM, Kyle Sluder wrote: > On Feb 20, 2013, at 8:30 PM, Jens Alfke wrote: > >> On Feb 20, 2013, at 8:22 PM, Kyle Sluder wrote: >> >>> You can accomplish this without writing to the file system, but it >>> involves foregoing NS

Re: NSTask arguments

2013-02-20 Thread Ken Thomases
On Feb 20, 2013, at 10:28 PM, Kyle Sluder wrote: > On Wed, Feb 20, 2013, at 08:22 PM, Kyle Sluder wrote: >> You can accomplish this without writing to the file system, but it >> involves foregoing NSTask. Fork, close stdin in the child process, open >> a pipe (so that the ch

Re: NSTask arguments

2013-02-20 Thread Kyle Sluder
Oh crap, NOW I get it. :P You don't have to do the fork dance at all. Just call -setStandardInput: and pass /dev/stdin as the filename argument. Let NSTask take care of the rest. --Kyle Sluder On Wed, Feb 20, 2013, at 08:30 PM, Jens Alfke wrote: > > On Feb 20, 2013, at 8:22 PM,

Re: NSTask arguments

2013-02-20 Thread Kyle Sluder
On Feb 20, 2013, at 8:30 PM, Jens Alfke wrote: > > On Feb 20, 2013, at 8:22 PM, Kyle Sluder wrote: > >> You can accomplish this without writing to the file system, but it >> involves foregoing NSTask. Fork, close stdin in the child process, open >> a pipe (so that

Re: NSTask arguments

2013-02-20 Thread Jens Alfke
On Feb 20, 2013, at 8:22 PM, Kyle Sluder wrote: > You can accomplish this without writing to the file system, but it > involves foregoing NSTask. Fork, close stdin in the child process, open > a pipe (so that the child gets the read end in fd 0), then exec the tool > with "/

Re: NSTask arguments

2013-02-20 Thread Kyle Sluder
On Wed, Feb 20, 2013, at 08:22 PM, Kyle Sluder wrote: > You can accomplish this without writing to the file system, but it > involves foregoing NSTask. Fork, close stdin in the child process, open > a pipe (so that the child gets the read end in fd 0), then exec the tool > with "/

  1   2   3   4   5   6   >