Skip to content

Commit 35b8ae8

Browse files
committed
Merge pull request #2813 from mboersma/fix-cli-unicode
fix(client): encode unicode properly for apps:run
2 parents a6e5f1c + d3526aa commit 35b8ae8

3 files changed

Lines changed: 6 additions & 3 deletions

File tree

client/deis.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -680,7 +680,7 @@ def apps_run(self, args):
680680
json.dumps(body))
681681
if response.status_code == requests.codes.ok:
682682
rc, output = json.loads(response.content)
683-
sys.stdout.write(output)
683+
sys.stdout.write(encode(output))
684684
sys.stdout.flush()
685685
sys.exit(rc)
686686
else:

controller/scheduler/fleet.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,9 @@ def _create_container(self, name, image, command, unit, **kwargs):
116116
entrypoint = kwargs.get('entrypoint')
117117
if entrypoint:
118118
l.update({'entrypoint': '{}'.format(entrypoint)})
119+
# encode command as utf-8
120+
if isinstance(l.get('command'), basestring):
121+
l['command'] = l['command'].encode('utf-8')
119122
# construct unit from template
120123
for f in unit:
121124
f['value'] = f['value'].format(**l)

tests/apps_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ var (
1515
appsCreateCmdNoRemote = "apps:create {{.AppName}} --no-remote"
1616
appsCreateCmdBuildpack = "apps:create {{.AppName}} --buildpack https://example.com"
1717
appsListCmd = "apps:list"
18-
appsRunCmd = "apps:run echo hello"
18+
appsRunCmd = "apps:run echo Hello, 世界"
1919
appsOpenCmd = "apps:open --app={{.AppName}}"
2020
appsLogsCmd = "apps:logs --app={{.AppName}}"
2121
appsInfoCmd = "apps:info --app={{.AppName}}"
@@ -111,7 +111,7 @@ func appsRunTest(t *testing.T, params *utils.DeisTestConfig) {
111111
if err := utils.Chdir(params.ExampleApp); err != nil {
112112
t.Fatal(err)
113113
}
114-
utils.Execute(t, cmd, params, false, "hello")
114+
utils.CheckList(t, cmd, params, "Hello, 世界", false)
115115
utils.Execute(t, "apps:run env", params, true, "GIT_SHA")
116116
// run a REALLY large command to test https://github.com/deis/deis/issues/2046
117117
largeString := randomString(1024)

0 commit comments

Comments
 (0)