public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/gentoopm:master commit in: gentoopm/bash/
@ 2011-07-10 21:37 Michał Górny
  0 siblings, 0 replies; 11+ messages in thread
From: Michał Górny @ 2011-07-10 21:37 UTC (permalink / raw
  To: gentoo-commits

commit:     ebfb3e76209ea26194e85391bd52ad1c91be9d37
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sun Jul 10 21:18:56 2011 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sun Jul 10 21:18:56 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gentoopm.git;a=commit;h=ebfb3e76

Implement bash parsing.

---
 gentoopm/bash/__init__.py   |   35 ++++++++++++++++++++++++
 gentoopm/bash/bashserver.py |   62 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 97 insertions(+), 0 deletions(-)

diff --git a/gentoopm/bash/__init__.py b/gentoopm/bash/__init__.py
new file mode 100644
index 0000000..ff7e31c
--- /dev/null
+++ b/gentoopm/bash/__init__.py
@@ -0,0 +1,35 @@
+#!/usr/bin/python
+#	vim:fileencoding=utf-8
+# (c) 2011 Michał Górny <mgorny@gentoo.org>
+# Released under the terms of the 2-clause BSD license.
+
+from abc import abstractmethod, abstractproperty
+
+from gentoopm.util import ABCObject
+
+class BashParser(ABCObject):
+	"""
+	A base class for bash script parsing facility.
+	"""
+
+	@abstractmethod
+	def load_file(self, f):
+		"""
+		Load and execute the contents of file.
+
+		@param f: the file to execute
+		@type f: file
+		"""
+		pass
+
+	@abstractmethod
+	def __getitem__(self, k):
+		"""
+		Get the value of an environment variable.
+
+		@param k: environment variable name
+		@type k: string
+		@return: value of the environment variable (or C{''} if unset)
+		@rtype: string
+		"""
+		pass

diff --git a/gentoopm/bash/bashserver.py b/gentoopm/bash/bashserver.py
new file mode 100644
index 0000000..7e490ee
--- /dev/null
+++ b/gentoopm/bash/bashserver.py
@@ -0,0 +1,62 @@
+#!/usr/bin/python
+#	vim:fileencoding=utf-8
+# (c) 2011 Michał Górny <mgorny@gentoo.org>
+# Released under the terms of the 2-clause BSD license.
+
+import shutil, subprocess, tempfile
+
+from gentoopm.bash import BashParser
+
+_bash_script = '''
+while true; do
+	(
+		source %s
+		while read -r __GENTOOPM_VARS; do
+			eval set -- ${__GENTOOPM_VARS}
+			if [[ ${#} -eq 0 ]]; then
+				# reload env file
+				break
+			else
+				printf "%%s\\0" "${@}"
+			fi
+		done
+	)
+done
+'''
+
+class BashServer(BashParser):
+	"""
+	Bash script parser built on backgrounded bash process.
+	"""
+
+	def __init__(self):
+		self._tmpf = tempfile.NamedTemporaryFile('w+b')
+		self._bashproc = subprocess.Popen(['bash', '-c',
+				_bash_script % repr(self._tmpf.name)],
+			stdin = subprocess.PIPE, stdout = subprocess.PIPE,
+			env = {})
+
+	def __del__(self):
+		self._bashproc.terminate()
+		self._bashproc.communicate()
+		self._tmpf.close()
+
+	def load_file(self, envf):
+		f = self._tmpf
+		f.seek(0, 0)
+		f.truncate(0)
+		shutil.copyfileobj(envf, f)
+		f.flush()
+
+		self._bashproc.stdin.write('\n'.encode('ASCII'))
+		self._bashproc.stdin.flush()
+
+	def __getitem__(self, k):
+		self._bashproc.stdin.write(('${%s}\n' % k).encode('ASCII'))
+		self._bashproc.stdin.flush()
+
+		f = self._bashproc.stdout
+		buf = ' '
+		while buf[-1] != '\0':
+			buf += f.read(1)
+		return buf[1:-1].decode('utf-8')



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [gentoo-commits] proj/gentoopm:master commit in: gentoopm/bash/
@ 2011-07-10 21:37 Michał Górny
  0 siblings, 0 replies; 11+ messages in thread
From: Michał Górny @ 2011-07-10 21:37 UTC (permalink / raw
  To: gentoo-commits

commit:     780400ffe4ed184315686cca84244b8ad0f10c94
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sun Jul 10 21:38:21 2011 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sun Jul 10 21:38:21 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gentoopm.git;a=commit;h=780400ff

BashServer: implement optimised get_env().

---
 gentoopm/bash/bashserver.py |   19 +++++++++++++++----
 1 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/gentoopm/bash/bashserver.py b/gentoopm/bash/bashserver.py
index 7e490ee..8fb8e09 100644
--- a/gentoopm/bash/bashserver.py
+++ b/gentoopm/bash/bashserver.py
@@ -51,12 +51,23 @@ class BashServer(BashParser):
 		self._bashproc.stdin.write('\n'.encode('ASCII'))
 		self._bashproc.stdin.flush()
 
-	def __getitem__(self, k):
-		self._bashproc.stdin.write(('${%s}\n' % k).encode('ASCII'))
-		self._bashproc.stdin.flush()
-
+	def _read1(self):
 		f = self._bashproc.stdout
 		buf = ' '
 		while buf[-1] != '\0':
 			buf += f.read(1)
 		return buf[1:-1].decode('utf-8')
+
+	def __getitem__(self, k):
+		self._bashproc.stdin.write(('${%s}\n' % k).encode('ASCII'))
+		self._bashproc.stdin.flush()
+
+		return self._read1()
+
+	def get_env(self, *varlist):
+		q = ' '.join(['"${%s}"' % v for v in varlist])
+		self._bashproc.stdin.write(('%s\n' % q).encode('ASCII'))
+		self._bashproc.stdin.flush()
+
+		ret = [self._read1() for v in varlist]
+		return dict(zip(varlist, ret))



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [gentoo-commits] proj/gentoopm:master commit in: gentoopm/bash/
@ 2011-07-10 21:37 Michał Górny
  0 siblings, 0 replies; 11+ messages in thread
From: Michał Górny @ 2011-07-10 21:37 UTC (permalink / raw
  To: gentoo-commits

commit:     4916d04d6e81893172e48dff28fac72c70dc6fdd
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sun Jul 10 21:29:49 2011 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sun Jul 10 21:29:49 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gentoopm.git;a=commit;h=4916d04d

BashParser: support getting multiple variables.

---
 gentoopm/bash/__init__.py |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/gentoopm/bash/__init__.py b/gentoopm/bash/__init__.py
index ff7e31c..53b9b88 100644
--- a/gentoopm/bash/__init__.py
+++ b/gentoopm/bash/__init__.py
@@ -33,3 +33,19 @@ class BashParser(ABCObject):
 		@rtype: string
 		"""
 		pass
+
+	def get_env(self, *varlist):
+		"""
+		Get values of multiple environment variables, and return them
+		as a dict.
+
+		@param varlist: environment variable names
+		@type varlist: list(string)
+		@return: environment variables with values
+		@rtype: dict(string -> string)
+		"""
+
+		out = {}
+		for v in varlist:
+			out[v] = self[v]
+		return out



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [gentoo-commits] proj/gentoopm:master commit in: gentoopm/bash/
@ 2011-07-15 12:34 Michał Górny
  0 siblings, 0 replies; 11+ messages in thread
From: Michał Górny @ 2011-07-15 12:34 UTC (permalink / raw
  To: gentoo-commits

commit:     b60984e9bd403b2df6576bbfc825949cd52cb324
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Fri Jul 15 11:56:56 2011 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Fri Jul 15 11:56:56 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gentoopm.git;a=commit;h=b60984e9

Fix getting single envkey off BashServer.

---
 gentoopm/bash/bashserver.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/gentoopm/bash/bashserver.py b/gentoopm/bash/bashserver.py
index f83c88b..e239bea 100644
--- a/gentoopm/bash/bashserver.py
+++ b/gentoopm/bash/bashserver.py
@@ -59,7 +59,7 @@ class BashServer(BashParser):
 		return buf[1:-1].decode('utf-8')
 
 	def __getitem__(self, k):
-		self._bashproc.stdin.write(('${%s}\n' % k).encode('ASCII'))
+		self._bashproc.stdin.write(('"${%s}"\n' % k).encode('ASCII'))
 		self._bashproc.stdin.flush()
 
 		return self._read1()



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [gentoo-commits] proj/gentoopm:master commit in: gentoopm/bash/
@ 2011-07-15 13:32 Michał Górny
  0 siblings, 0 replies; 11+ messages in thread
From: Michał Górny @ 2011-07-15 13:32 UTC (permalink / raw
  To: gentoo-commits

commit:     d438199013598b1cd48c5770f7855e91dd23df81
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Fri Jul 15 13:30:45 2011 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Fri Jul 15 13:30:45 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gentoopm.git;a=commit;h=d4381990

BashServer: use bytes for pipe I/O.

---
 gentoopm/bash/bashserver.py |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/gentoopm/bash/bashserver.py b/gentoopm/bash/bashserver.py
index e239bea..9fbd33e 100644
--- a/gentoopm/bash/bashserver.py
+++ b/gentoopm/bash/bashserver.py
@@ -53,8 +53,8 @@ class BashServer(BashParser):
 
 	def _read1(self):
 		f = self._bashproc.stdout
-		buf = ' '
-		while buf[-1] != '\0':
+		buf = b' '
+		while not buf.endswith(b'\0'):
 			buf += f.read(1)
 		return buf[1:-1].decode('utf-8')
 



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [gentoo-commits] proj/gentoopm:master commit in: gentoopm/bash/
@ 2011-07-15 16:08 Michał Górny
  0 siblings, 0 replies; 11+ messages in thread
From: Michał Górny @ 2011-07-15 16:08 UTC (permalink / raw
  To: gentoo-commits

commit:     fc0681e6122c0e1da42d9082d4337d434580d471
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Fri Jul 15 14:57:48 2011 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Fri Jul 15 14:57:48 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gentoopm.git;a=commit;h=fc0681e6

BashServer: commonize command writing code.

---
 gentoopm/bash/bashserver.py |   22 ++++++++++++----------
 1 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/gentoopm/bash/bashserver.py b/gentoopm/bash/bashserver.py
index f8740fd..1690627 100644
--- a/gentoopm/bash/bashserver.py
+++ b/gentoopm/bash/bashserver.py
@@ -48,8 +48,7 @@ class BashServer(BashParser):
 		shutil.copyfileobj(envf, f)
 		f.flush()
 
-		self._bashproc.stdin.write('set --\n'.encode('ASCII'))
-		self._bashproc.stdin.flush()
+		self._write('set --')
 
 	def _read1(self):
 		f = self._bashproc.stdout
@@ -58,16 +57,19 @@ class BashServer(BashParser):
 			buf += f.read(1)
 		return buf[1:-1].decode('utf-8')
 
-	def __getitem__(self, k):
-		self._bashproc.stdin.write(('set -- "${%s}"\n' % k).encode('ASCII'))
+	def _write(self, *cmds):
+		for cmd in cmds:
+			self._bashproc.stdin.write(('%s\n' % cmd).encode('ASCII'))
 		self._bashproc.stdin.flush()
 
-		return self._read1()
-
-	def copy(self, *varlist):
+	def _cmd_print(self, *varlist):
 		q = ' '.join(['"${%s}"' % v for v in varlist])
-		self._bashproc.stdin.write(('set -- %s\n' % q).encode('ASCII'))
-		self._bashproc.stdin.flush()
+		self._write('set -- %s' % q)
+		return [self._read1() for v in varlist]
+
+	def __getitem__(self, k):
+		return self._cmd_print(k)[0]
 
-		ret = [self._read1() for v in varlist]
+	def copy(self, *varlist):
+		ret = self._cmd_print(*varlist)
 		return dict(zip(varlist, ret))



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [gentoo-commits] proj/gentoopm:master commit in: gentoopm/bash/
@ 2011-07-15 16:08 Michał Górny
  0 siblings, 0 replies; 11+ messages in thread
From: Michał Górny @ 2011-07-15 16:08 UTC (permalink / raw
  To: gentoo-commits

commit:     b4682ea50b068eb923c34bb4d26459711fa9cf04
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Fri Jul 15 14:49:55 2011 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Fri Jul 15 14:49:55 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gentoopm.git;a=commit;h=b4682ea5

BashServer: pass a complete command to the server.

---
 gentoopm/bash/bashserver.py |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/gentoopm/bash/bashserver.py b/gentoopm/bash/bashserver.py
index 9fbd33e..f8740fd 100644
--- a/gentoopm/bash/bashserver.py
+++ b/gentoopm/bash/bashserver.py
@@ -11,8 +11,8 @@ _bash_script = '''
 while true; do
 	(
 		source %s
-		while read -r __GENTOOPM_VARS; do
-			eval set -- ${__GENTOOPM_VARS}
+		while read -r __GENTOOPM_CMD; do
+			eval ${__GENTOOPM_CMD}
 			if [[ ${#} -eq 0 ]]; then
 				# reload env file
 				break
@@ -48,7 +48,7 @@ class BashServer(BashParser):
 		shutil.copyfileobj(envf, f)
 		f.flush()
 
-		self._bashproc.stdin.write('\n'.encode('ASCII'))
+		self._bashproc.stdin.write('set --\n'.encode('ASCII'))
 		self._bashproc.stdin.flush()
 
 	def _read1(self):
@@ -59,14 +59,14 @@ class BashServer(BashParser):
 		return buf[1:-1].decode('utf-8')
 
 	def __getitem__(self, k):
-		self._bashproc.stdin.write(('"${%s}"\n' % k).encode('ASCII'))
+		self._bashproc.stdin.write(('set -- "${%s}"\n' % k).encode('ASCII'))
 		self._bashproc.stdin.flush()
 
 		return self._read1()
 
 	def copy(self, *varlist):
 		q = ' '.join(['"${%s}"' % v for v in varlist])
-		self._bashproc.stdin.write(('%s\n' % q).encode('ASCII'))
+		self._bashproc.stdin.write(('set -- %s\n' % q).encode('ASCII'))
 		self._bashproc.stdin.flush()
 
 		ret = [self._read1() for v in varlist]



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [gentoo-commits] proj/gentoopm:master commit in: gentoopm/bash/
@ 2011-07-15 16:08 Michał Górny
  0 siblings, 0 replies; 11+ messages in thread
From: Michał Górny @ 2011-07-15 16:08 UTC (permalink / raw
  To: gentoo-commits

commit:     49592d5dd7f16f63c4160a919d64e27f4ebe1943
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Fri Jul 15 15:27:08 2011 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Fri Jul 15 15:28:32 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gentoopm.git;a=commit;h=49592d5d

BashServer: don't hardcode any specific bash commands.

---
 gentoopm/bash/bashserver.py |   16 +++++-----------
 1 files changed, 5 insertions(+), 11 deletions(-)

diff --git a/gentoopm/bash/bashserver.py b/gentoopm/bash/bashserver.py
index 1690627..f65535e 100644
--- a/gentoopm/bash/bashserver.py
+++ b/gentoopm/bash/bashserver.py
@@ -10,15 +10,8 @@ from gentoopm.bash import BashParser
 _bash_script = '''
 while true; do
 	(
-		source %s
 		while read -r __GENTOOPM_CMD; do
 			eval ${__GENTOOPM_CMD}
-			if [[ ${#} -eq 0 ]]; then
-				# reload env file
-				break
-			else
-				printf "%%s\\0" "${@}"
-			fi
 		done
 	)
 done
@@ -31,8 +24,7 @@ class BashServer(BashParser):
 
 	def __init__(self):
 		self._tmpf = tempfile.NamedTemporaryFile('w+b')
-		self._bashproc = subprocess.Popen(['bash', '-c',
-				_bash_script % repr(self._tmpf.name)],
+		self._bashproc = subprocess.Popen(['bash', '-c', _bash_script],
 			stdin = subprocess.PIPE, stdout = subprocess.PIPE,
 			env = {})
 
@@ -48,7 +40,8 @@ class BashServer(BashParser):
 		shutil.copyfileobj(envf, f)
 		f.flush()
 
-		self._write('set --')
+		self._write('break',
+				'source %s' % repr(f.name))
 
 	def _read1(self):
 		f = self._bashproc.stdout
@@ -64,7 +57,8 @@ class BashServer(BashParser):
 
 	def _cmd_print(self, *varlist):
 		q = ' '.join(['"${%s}"' % v for v in varlist])
-		self._write('set -- %s' % q)
+		self._write('set -- %s' % q,
+				'printf "%s\\0" "${@}"')
 		return [self._read1() for v in varlist]
 
 	def __getitem__(self, k):



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [gentoo-commits] proj/gentoopm:master commit in: gentoopm/bash/
@ 2011-07-17 21:21 Michał Górny
  0 siblings, 0 replies; 11+ messages in thread
From: Michał Górny @ 2011-07-17 21:21 UTC (permalink / raw
  To: gentoo-commits

commit:     dc7905fbd4aa0ec1305cf4b246794f8b7de0f328
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sun Jul 17 21:21:22 2011 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sun Jul 17 21:21:22 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gentoopm.git;a=commit;h=dc7905fb

Fix looping BashServer when pipes are closed.

Ensure BashServer will exit when stdin is closed (read returns non-zero)
rather than letting it loop and eat CPU.

---
 gentoopm/bash/bashserver.py |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/gentoopm/bash/bashserver.py b/gentoopm/bash/bashserver.py
index 98d5ede..774c741 100644
--- a/gentoopm/bash/bashserver.py
+++ b/gentoopm/bash/bashserver.py
@@ -9,12 +9,15 @@ from gentoopm.bash import BashParser
 from gentoopm.exceptions import InvalidBashCodeError
 
 _bash_script = '''
-while true; do
+while
 	(
 		while read -r __GENTOOPM_CMD; do
 			eval ${__GENTOOPM_CMD}
 		done
+		exit 1
 	)
+do
+	:
 done
 '''
 
@@ -37,7 +40,7 @@ class BashServer(BashParser):
 		shutil.copyfileobj(envf, f)
 		f.flush()
 
-		self._write('break',
+		self._write('exit 0',
 				'source %s && printf "OK\\0" || printf "FAIL\\0"' % repr(f.name))
 		resp = self._read1()
 		f.close()



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [gentoo-commits] proj/gentoopm:master commit in: gentoopm/bash/
@ 2013-08-04 12:52 Michał Górny
  0 siblings, 0 replies; 11+ messages in thread
From: Michał Górny @ 2013-08-04 12:52 UTC (permalink / raw
  To: gentoo-commits

commit:     60be72ab342125187f42cf574a43fe8def36b423
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sun Aug  4 12:49:10 2013 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sun Aug  4 12:52:31 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gentoopm.git;a=commit;h=60be72ab

Use 'bash -n' to check syntax rather than 'source' output.

This fixes throwing InvalidBashCodeError whenever script ends with
a command having non-zero exit status.

---
 gentoopm/bash/bashserver.py | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/gentoopm/bash/bashserver.py b/gentoopm/bash/bashserver.py
index 850f2ab..0db1dff 100644
--- a/gentoopm/bash/bashserver.py
+++ b/gentoopm/bash/bashserver.py
@@ -42,8 +42,14 @@ class BashServer(BashParser):
 		f.flush()
 
 		self._write('exit 0',
-				'source %s && printf "OK\\0" || printf "FAIL\\0"' % repr(f.name))
+				'bash -n %s && printf "OK\\0" || printf "FAIL\\0"' % repr(f.name))
 		resp = self._read1()
+
+		if resp == 'OK':
+			self._write('source %s >&2; printf "DONE\\0"' % repr(f.name))
+		if self._read1() != 'DONE':
+			raise AssertionError('Sourcing unexpected caused stdout output')
+
 		f.close()
 
 		if resp != 'OK':


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [gentoo-commits] proj/gentoopm:master commit in: gentoopm/bash/
@ 2013-08-05  8:50 Michał Górny
  0 siblings, 0 replies; 11+ messages in thread
From: Michał Górny @ 2013-08-05  8:50 UTC (permalink / raw
  To: gentoo-commits

commit:     998a0462a7fa71627f437b4e8b1310cc7de88962
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Mon Aug  5 08:50:28 2013 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Mon Aug  5 08:50:28 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gentoopm.git;a=commit;h=998a0462

BashParser: just discard error output for now.

---
 gentoopm/bash/bashserver.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gentoopm/bash/bashserver.py b/gentoopm/bash/bashserver.py
index 0db1dff..69ed831 100644
--- a/gentoopm/bash/bashserver.py
+++ b/gentoopm/bash/bashserver.py
@@ -42,11 +42,11 @@ class BashServer(BashParser):
 		f.flush()
 
 		self._write('exit 0',
-				'bash -n %s && printf "OK\\0" || printf "FAIL\\0"' % repr(f.name))
+				'bash -n %s &>/dev/null && printf "OK\\0" || printf "FAIL\\0"' % repr(f.name))
 		resp = self._read1()
 
 		if resp == 'OK':
-			self._write('source %s >&2; printf "DONE\\0"' % repr(f.name))
+			self._write('source %s &>/dev/null; printf "DONE\\0"' % repr(f.name))
 		if self._read1() != 'DONE':
 			raise AssertionError('Sourcing unexpected caused stdout output')
 


^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2013-08-05  8:50 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-07-15 16:08 [gentoo-commits] proj/gentoopm:master commit in: gentoopm/bash/ Michał Górny
  -- strict thread matches above, loose matches on Subject: below --
2013-08-05  8:50 Michał Górny
2013-08-04 12:52 Michał Górny
2011-07-17 21:21 Michał Górny
2011-07-15 16:08 Michał Górny
2011-07-15 16:08 Michał Górny
2011-07-15 13:32 Michał Górny
2011-07-15 12:34 Michał Górny
2011-07-10 21:37 Michał Górny
2011-07-10 21:37 Michał Górny
2011-07-10 21:37 Michał Górny

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox