Michał Górny avatar Michał Górny committed b4682ea

BashServer: pass a complete command to the server.

Comments (0)

Files changed (1)

gentoopm/bash/bashserver.py

 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
 		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):
 		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]
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.