From 050b70174590169cdb6ab5fa25426f22e8a018be Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Sun, 11 Jan 2009 01:20:07 +1100 Subject: [PATCH] Make io.system behave like Vim with a default 'shellredir' setting. --- common/content/io.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/common/content/io.js b/common/content/io.js index bcec870a..57326861 100644 --- a/common/content/io.js +++ b/common/content/io.js @@ -1041,27 +1041,27 @@ lookup: function escape(str) '"' + str.replace(/[\\"$]/g, "\\$&") + '"'; - return this.withTempFiles(function (stdin, stdout, stderr, cmd) { + return this.withTempFiles(function (stdin, stdout, cmd) { if (input) this.writeFile(stdin, input); + // TODO: implement 'shellredir' if (WINDOWS) { - command = "cd /D " + cwd.path + " && " + command + " > " + stdout.path + " 2> " + stderr.path + " < " + stdin.path; + command = "cd /D " + cwd.path + " && " + command + " > " + stdout.path + " 2>&1" + " < " + stdin.path; var res = this.run(options["shell"], options["shellcmdflag"].split(/\s+/).concat(command), true); } else { this.writeFile(cmd, "cd " + escape(cwd.path) + "\n" + - ["exec", ">" + escape(stdout.path), "2>" + escape(stderr.path), "<" + escape(stdin.path), + ["exec", ">" + escape(stdout.path), "2>&1", "<" + escape(stdin.path), escape(options["shell"]), options["shellcmdflag"], escape(command)].join(" ")); res = this.run("/bin/sh", ["-e", cmd.path], true); } - // FIXME: Is this really right? Shouldn't we always show both? if (res > 0) - var output = self.readFile(stderr) + "\nshell returned " + res; + var output = self.readFile(stdout) + "\nshell returned " + res; else output = self.readFile(stdout);