[Swift-devel] New built-in system, request for comments

Ketan Maheshwari ketan at mcs.anl.gov
Sat Apr 5 19:59:08 CDT 2014


I agree this might not be needed in most cases. I was thinking of commands
or external programs that emit both stdout and stderr and say the list of
files that needs to be mapped are emitted only on one of the streams, in
such case user might want to ignore the other stream. Exitcode in this
context is a different issue.

For instance, user might have a Swift script that produce user written
trace() on stdout while progress log on stderr. In such case, this might be
useful:

file folder[ ] < array_mapper; files = system ("swift genfiles.swift", 1) >;

where 1 would mean only put the stdout into folder array.

Thanks,
-Ketan


On Sat, Apr 5, 2014 at 7:01 PM, Yadu Nand Babuji <yadunand at uchicago.edu>wrote:

>  Ketan,
>
> Do we need that ? If you add stdout, stderr and say exitcode as returns,
> the user has no
> choice but to define variables to hold those return values.
>
> Mihael mentioned in a separate thread that the behavior should be to fail
> early in case the
> executed string returns a non-zero exitcode.
>
> -Yadu
>
>
> On 04/04/2014 10:58 PM, Ketan Maheshwari wrote:
>
> Is it possible to handle stdout and/or stderr of system("command")
> separately? That way, it might be useful in other places as well.
>
>
> On Fri, Apr 4, 2014 at 12:08 PM, Yadu Nand <yadudoc1729 at gmail.com> wrote:
>
>> Hi,
>>
>> I have just added a new builtin "system" to trunk. It takes a string,
>> which is executed in the shell
>> by java and the results are returned as an array. This is done to make
>> mappings easier, for example,
>> you can map an entire folder "foo" using the following :
>>
>> file folder[ ] < array_mapper; files = system ("find foo -type f") >;
>>
>> If the execution of the string provided fails, the logger would report
>> the the exitcode and stderr to
>> the swift stdout.
>>
>> Thanks,
>> Yadu Nand B
>> _______________________________________________
>> Swift-devel mailing list
>> Swift-devel at ci.uchicago.edu
>> https://lists.ci.uchicago.edu/cgi-bin/mailman/listinfo/swift-devel
>>
>
>
>
> _______________________________________________
> Swift-devel mailing listSwift-devel at ci.uchicago.eduhttps://lists.ci.uchicago.edu/cgi-bin/mailman/listinfo/swift-devel
>
>
>
> _______________________________________________
> Swift-devel mailing list
> Swift-devel at ci.uchicago.edu
> https://lists.ci.uchicago.edu/cgi-bin/mailman/listinfo/swift-devel
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/swift-devel/attachments/20140405/1a0c8d0d/attachment.html>


More information about the Swift-devel mailing list