Re: [swift-corelibs-dev] Better integration with UNIX tools

2017-12-01 Thread Philippe Hausler via swift-corelibs-dev
Looking through some of them they are somewhat similar to the Foundation APIs, but there are a few improvements that I think would make them more compelling for generalized use. I don’t think that it is out of the question to perhaps merge the two concepts and reduce to Foundation as the place t

Re: [swift-corelibs-dev] Better integration with UNIX tools

2017-12-01 Thread Daniel Dunbar via swift-corelibs-dev
> On Dec 1, 2017, at 6:28 AM, Ian Partridge via swift-corelibs-dev > wrote: > > Hi Nick, > > You might be interested in the new Utility project that the Package > Manager team have published. It has a bunch of Foundation-esque > features including subprocess support, temporary file, progress

Re: [swift-corelibs-dev] Better integration with UNIX tools

2017-12-01 Thread Ian Partridge via swift-corelibs-dev
Hi Nick, You might be interested in the new Utility project that the Package Manager team have published. It has a bunch of Foundation-esque features including subprocess support, temporary file, progress bars and more. There's a good blog post about it here: https://www.hackingwithswift.com/art

Re: [swift-corelibs-dev] Better integration with UNIX tools

2017-11-30 Thread Tony Parker via swift-corelibs-dev
Why did we give up so easily? I did not say that scripting support is somehow a non-goal. In fact, it is exactly the opposite. I do not believe that somehow API that is useful for scripts is mutually exclusive with API that is useful for apps. - Tony > On Nov 30, 2017, at 9:26 AM, Jacob Willia

Re: [swift-corelibs-dev] Better integration with UNIX tools

2017-11-30 Thread Jacob Williams via swift-corelibs-dev
Since this isn’t going to be coming to Foundation any time…ever, I’d take a look at the SwiftShell framework. It makes running command line utilities from swift pretty easy. Chaining outputs from previous commands into subsequent commands is also rather simple. It’s based on Process but gives a

Re: [swift-corelibs-dev] Better integration with UNIX tools

2017-11-30 Thread Nick Keets via swift-corelibs-dev
In that case I think the discussion is kind of moot, scripts are fundamentally different than apps, being terse is important and almost always you want to block. If better scripting support is a non-goal for Foundation then `Process` is mostly fine as it is. My only wish would be to somehow make i

Re: [swift-corelibs-dev] Better integration with UNIX tools

2017-11-28 Thread Tony Parker via swift-corelibs-dev
Of course, Foundation API has no way of distinguishing if the caller is considered a script or not. If the API is a bad idea for other kinds of apps then we simply wouldn’t add it. So, I think this proposed convenience API needs to consider all of the varied clients of Foundation. - Tony > On

Re: [swift-corelibs-dev] Better integration with UNIX tools

2017-11-28 Thread Brent Royal-Gordon via swift-corelibs-dev
> On Nov 28, 2017, at 8:00 AM, Tony Parker wrote: > > Why does it imply a run loop rather than one of many multithreading > possibilities (dispatch queue, starting one more thread, etc)? And even if it > did use run loops, why is that a problem? The problem is simply that we're discussing usi

Re: [swift-corelibs-dev] Better integration with UNIX tools

2017-11-28 Thread Sneed, Brandon via swift-corelibs-dev
on behalf of William Dillon via swift-corelibs-dev Reply-To: William Dillon Date: Friday, November 17, 2017 at 11:39 AM To: Tony Parker Cc: "swift-corelibs-dev@swift.org" Subject: Re: [swift-corelibs-dev] Better integration with UNIX tools I, to, have wished for such an API. I think th

Re: [swift-corelibs-dev] Better integration with UNIX tools

2017-11-28 Thread Tony Parker via swift-corelibs-dev
Why does it imply a run loop rather than one of many multithreading possibilities (dispatch queue, starting one more thread, etc)? And even if it did use run loops, why is that a problem? In general we have been discouraging the use of synchronous and blocking API for many years now. It’s conve

Re: [swift-corelibs-dev] Better integration with UNIX tools

2017-11-27 Thread Brent Royal-Gordon via swift-corelibs-dev
> On Nov 27, 2017, at 11:01 PM, Brent Royal-Gordon > wrote: > > We aren't today Sorry, this part of the sentence got mangled in editing. What I meant to say is, script-style programs currently don't run under a runloop, so if this API is being designed for scripting use, a completion handler

Re: [swift-corelibs-dev] Better integration with UNIX tools

2017-11-27 Thread Brent Royal-Gordon via swift-corelibs-dev
> On Nov 27, 2017, at 3:50 PM, Tony Parker via swift-corelibs-dev > wrote: > > I was thinking of perhaps a completion handler version, with the expectation > that once async/await style completions land it would be pretty easy to use > in a kind of straight-line mechanism. A completion handle

Re: [swift-corelibs-dev] Better integration with UNIX tools

2017-11-27 Thread Tony Parker via swift-corelibs-dev
Hi Nick, Thanks for this survey of other languages, it’s very useful. I think if we were to add something, I would prefer to keep it simple. Just one class method on Process which is a fairly straightforward wrapper of the other functionality already there. I was thinking of perhaps a completi

Re: [swift-corelibs-dev] Better integration with UNIX tools

2017-11-21 Thread William Dillon via swift-corelibs-dev
I cosign all of this. Nice work, Brent. > On Nov 17, 2017, at 4:47 PM, Brent Royal-Gordon via swift-corelibs-dev > wrote: > >> On Nov 17, 2017, at 11:34 AM, Tony Parker via swift-corelibs-dev >> mailto:swift-corelibs-dev@swift.org>> wrote: >> >> It does seem like there is a possibility of so

Re: [swift-corelibs-dev] Better integration with UNIX tools

2017-11-20 Thread Nick Keets via swift-corelibs-dev
Looking at what Python (subprocess) and Go (os.exec) do, it looks like they agree on the following: - executable and arguments are merged in one array - they don't require full path for the executable - they don't expand tildes - blocking calls are the default - they are more explicit about st

Re: [swift-corelibs-dev] Better integration with UNIX tools

2017-11-19 Thread Brent Royal-Gordon via swift-corelibs-dev
> On Nov 19, 2017, at 7:01 PM, Abhi Beckert wrote: > > First of all, I disagree with Brent's assessment that we shouldn't have a > variant that "simply shells out". Even though this use case is "discouraged" > in other languages, I think in practice it definitely has a place. If you really wan

Re: [swift-corelibs-dev] Better integration with UNIX tools

2017-11-19 Thread Abhi Beckert via swift-corelibs-dev
> Any ideas on what form it would take? A class method on Process that > returns the output, maybe? I think there are two solutions, and I'd like to see both of them taken. First of all, I disagree with Brent's assessment that we shouldn't have a variant that "simply shells out". Even though this u

Re: [swift-corelibs-dev] Better integration with UNIX tools

2017-11-17 Thread Brent Royal-Gordon via swift-corelibs-dev
> On Nov 17, 2017, at 11:34 AM, Tony Parker via swift-corelibs-dev > wrote: > > It does seem like there is a possibility of some better convenience API here. > > Any ideas on what form it would take? A class method on Process that returns > the output, maybe? `Process.run(_:arguments:terminat

Re: [swift-corelibs-dev] Better integration with UNIX tools

2017-11-17 Thread William Dillon via swift-corelibs-dev
I, to, have wished for such an API. I think that would be a very welcome addition. > On Nov 17, 2017, at 11:34 AM, Tony Parker via swift-corelibs-dev > wrote: > > Hi Abhi, > > It does seem like there is a possibility of some better convenience API here. > > Any ideas on what form it would ta

Re: [swift-corelibs-dev] Better integration with UNIX tools

2017-11-17 Thread Tony Parker via swift-corelibs-dev
Hi Abhi, It does seem like there is a possibility of some better convenience API here. Any ideas on what form it would take? A class method on Process that returns the output, maybe? - Tony > On Nov 16, 2017, at 3:34 PM, Abhi Beckert via swift-corelibs-dev > wrote: > > Swift is a great shel