aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/os/shell.c
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2014-10-02 09:49:11 -0400
committerJustin M. Keyes <justinkz@gmail.com>2014-10-02 09:49:11 -0400
commit60e5d8d1ccd5a07038138f18752620edebeb8a3d (patch)
tree1633766a082252e2b1074968377d1fd98481e496 /src/nvim/os/shell.c
parent1f622d63bcd3018e5e714c02e6d0b58431c658e4 (diff)
parent45525853d3521e73512f68bb390aae0e385ef66c (diff)
downloadrneovim-60e5d8d1ccd5a07038138f18752620edebeb8a3d.tar.gz
rneovim-60e5d8d1ccd5a07038138f18752620edebeb8a3d.tar.bz2
rneovim-60e5d8d1ccd5a07038138f18752620edebeb8a3d.zip
Merge pull request #1260 from tarruda/system-specs
Fix coverity defect(Resource leak) and add some specs which expose the bug to valgrind
Diffstat (limited to 'src/nvim/os/shell.c')
-rw-r--r--src/nvim/os/shell.c19
1 files changed, 2 insertions, 17 deletions
diff --git a/src/nvim/os/shell.c b/src/nvim/os/shell.c
index 398d94b606..912dc95aca 100644
--- a/src/nvim/os/shell.c
+++ b/src/nvim/os/shell.c
@@ -293,19 +293,15 @@ int os_system(const char *cmd,
if (input) {
WBuffer *input_buffer = wstream_new_buffer((char *) input, len, 1, NULL);
- // we want to be notified when the write completes
- job_write_cb(job, system_write_cb);
-
if (!job_write(job, input_buffer)) {
// couldn't write, stop the job and tell the user about it
job_stop(job);
return -1;
}
- } else {
- // close the input stream, let the process know that no input is coming
- job_close_in(job);
}
+ // close the input stream, let the process know that no more input is coming
+ job_close_in(job);
int status = job_wait(job, -1);
// prepare the out parameters if requested
@@ -353,17 +349,6 @@ static void system_data_cb(RStream *rstream, void *data, bool eof)
buf->len += nread;
}
-static void system_write_cb(WStream *wstream,
- void *data,
- size_t pending,
- int status)
-{
- if (pending == 0) {
- Job *job = data;
- job_close_in(job);
- }
-}
-
/// Parses a command string into a sequence of words, taking quotes into
/// consideration.
///