From 0e2d07c801be8a35a424332115dbd33540a3a82b Mon Sep 17 00:00:00 2001 From: Matthias Lederhofer Date: Wed, 2 Apr 2014 23:10:03 +0100 Subject: use /bin/sh to run the pager This allows to specify options on the command-line of the pager, e.g. $ ledger --color --pager='less -R' ... --- src/stream.cc | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) (limited to 'src/stream.cc') diff --git a/src/stream.cc b/src/stream.cc index fcd030b6..e4eb7800 100644 --- a/src/stream.cc +++ b/src/stream.cc @@ -80,18 +80,10 @@ namespace { close(pfd[1]); close(pfd[0]); - // Find command name: its the substring starting right of the - // rightmost '/' character in the pager pathname. See manpage for - // strrchr. -#if BOOST_VERSION >= 103700 - path basename(pager_path.filename()); -#else - path basename(pager_path.leaf()); -#endif - execlp(pager_path.string().c_str(), basename.string().c_str(), NULL); + execlp("/bin/sh", "/bin/sh", "-c", pager_path.string().c_str(), NULL); // We should never, ever reach here - perror((std::string("execlp: ") + pager_path.string()).c_str()); + perror("execlp: /bin/sh"); exit(1); } else { // parent -- cgit v1.2.3