Created
June 6, 2012 17:42
-
-
Save vivien/2883502 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 2ac63f597648408c225ea43a447363f7b913a035 Mon Sep 17 00:00:00 2001 | |
From: Vivien Didelot <[email protected]> | |
Date: Wed, 6 Jun 2012 12:24:47 -0400 | |
Subject: [PATCH] io: use system() if a command contains a pipe | |
Signed-off-by: Vivien Didelot <[email protected]> | |
--- | |
io.c | 4 ++++ | |
1 file changed, 4 insertions(+) | |
diff --git a/io.c b/io.c | |
index 0c1a8f7..5c46e2a 100644 | |
--- a/io.c | |
+++ b/io.c | |
@@ -309,9 +309,13 @@ io_run(struct io *io, enum io_type type, const char *dir, const char *argv[], .. | |
{ | |
int pipefds[2] = { -1, -1 }; | |
va_list args; | |
+ char cmd[SIZEOF_STR]; | |
io_init(io); | |
+ if (argv_to_string(argv, cmd, sizeof(cmd), " ") && strchr(cmd, '|')) | |
+ return !!system(cmd); | |
+ | |
if (dir && !strcmp(dir, argv[0])) | |
return io_open(io, "%s%s", dir, argv[1]); | |
-- | |
1.7.10.2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment