mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-02-22 19:05:46 +01:00
Make io.system behave like Vim with a default 'shellredir' setting.
This commit is contained in:
@@ -1041,27 +1041,27 @@ lookup:
|
|||||||
|
|
||||||
function escape(str) '"' + str.replace(/[\\"$]/g, "\\$&") + '"';
|
function escape(str) '"' + str.replace(/[\\"$]/g, "\\$&") + '"';
|
||||||
|
|
||||||
return this.withTempFiles(function (stdin, stdout, stderr, cmd) {
|
return this.withTempFiles(function (stdin, stdout, cmd) {
|
||||||
if (input)
|
if (input)
|
||||||
this.writeFile(stdin, input);
|
this.writeFile(stdin, input);
|
||||||
|
|
||||||
|
// TODO: implement 'shellredir'
|
||||||
if (WINDOWS)
|
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);
|
var res = this.run(options["shell"], options["shellcmdflag"].split(/\s+/).concat(command), true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
||||||
this.writeFile(cmd, "cd " + escape(cwd.path) + "\n" +
|
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(" "));
|
escape(options["shell"]), options["shellcmdflag"], escape(command)].join(" "));
|
||||||
res = this.run("/bin/sh", ["-e", cmd.path], true);
|
res = this.run("/bin/sh", ["-e", cmd.path], true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: Is this really right? Shouldn't we always show both?
|
|
||||||
if (res > 0)
|
if (res > 0)
|
||||||
var output = self.readFile(stderr) + "\nshell returned " + res;
|
var output = self.readFile(stdout) + "\nshell returned " + res;
|
||||||
else
|
else
|
||||||
output = self.readFile(stdout);
|
output = self.readFile(stdout);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user