digitalmars.D.learn - String from executeshell
- William Dunne (8/8) Apr 29 2015 I'm trying to run this command:
- =?UTF-8?B?QWxpIMOHZWhyZWxp?= (11/18) Apr 29 2015 executeShell returns the status and the output as a type (perhaps a
- =?UTF-8?B?QWxpIMOHZWhyZWxp?= (5/6) Apr 29 2015 Certainly not. The output is an object of a special type, which the
- Adam D. Ruppe (5/8) Apr 29 2015 That's idiotic, to be frank, it should just be a traditional
- Vladimir Panteleev (2/9) Apr 29 2015
I'm trying to run this command: wget -O - URL | gpg -d and get the result of the action, but I can't quite work out to do it. currently it looks like: executeShell(escapeShellCommand("wget", "-O", "-", url, "|", "gpg", "-D")); But I can't work out how to pull the string returned with this. Any help?
Apr 29 2015
On 04/29/2015 02:05 PM, William Dunne wrote:I'm trying to run this command: wget -O - URL | gpg -d and get the result of the action, but I can't quite work out to do it. currently it looks like: executeShell(escapeShellCommand("wget", "-O", "-", url, "|", "gpg", "-D")); But I can't work out how to pull the string returned with this. Any help?executeShell returns the status and the output as a type (perhaps a tuple? :) ): You use the return value for both the status and the output: auto wget = executeShell(escapeShellCommand(/* ... */)); if (wget.status == 0) { /* success */ writeln(wget.output); // <-- HERE } Ali
Apr 29 2015
On 04/29/2015 02:54 PM, Ali Çehreli wrote:executeShell returns the status and the output as a typeCertainly not. The output is an object of a special type, which the documentation refers to as 'auto'. Grrr... :) Ok, maybe it's a Voldemort type. Anyway... Ali
Apr 29 2015
On Wednesday, 29 April 2015 at 21:56:18 UTC, Ali Çehreli wrote:Certainly not. The output is an object of a special type, which the documentation refers to as 'auto'. Grrr... :) Ok, maybe it's a Voldemort type. Anyway...That's idiotic, to be frank, it should just be a traditional struct declared outside. "Just because we can do a thing, it does not necessarily follow that we must do that thing" -- from the Gospel of Kirk
Apr 29 2015
On Wednesday, 29 April 2015 at 21:56:18 UTC, Ali Çehreli wrote:On 04/29/2015 02:54 PM, Ali Çehreli wrote:The function's documentation has a "Returns" section, which says:executeShell returns the status and the output as a typeCertainly not. The output is an object of a special type, which the documentation refers to as 'auto'. Grrr... :) Ok, maybe it's a Voldemort type. Anyway...Returns: An std.typecons.Tuple!(int, "status", string, "output").
Apr 29 2015